当前位置:网站首页>C connection of new world Internet of things cloud platform (simple understanding version)
C connection of new world Internet of things cloud platform (simple understanding version)
2022-04-23 07:11:00 【Xiaoye is stupid!】
List of articles
Preface
This article is only for the principles of Internet of things connectivity in the new world 、 Preliminary understanding of the steps , Not as a final realization .
One 、 Simple understanding SDK and API The difference between ?
There's a sealed drink , It's called “SDK”.
There's a straw in the drink , The name of the straw is “API”.
Call you “XX System ”.
If you want to drink SDK Drinks in ( Having the system makes SDK The function of ), You have to pass API This straw to achieve ( adopt API Connect your system to SDK tool kit ), Otherwise you won't have a drink .
therefore :
SDK= A software package with the features you want
API=SDK The only interface on
Two 、 Use steps
1. Import and stock in

introduce :
using NLECloudSDK;
using Newtonsoft.Json;
2. Code implementation :
namespace WpfCLoud
{
public partial class MainWindow : Window
{
NLECloudAPI api = new NLECloudAPI ("http://api.nlecloud.com");// Pass in api Interface
AccountLoginDTO dto = new AccountLoginDTO ();// Account login data transfer object (DTO: Data transmission object )
string Token = "";// Define global variable storage Token Login token
dynamic Data;// Defines all the universal variables used to receive the returned Json(【 Data returned from the web page 】Json: Data ultra lightweight data exchange format )
string value;// The number
public MainWindow ()
{
InitializeComponent ();
dto.Account = "1111111111";// For example, the variables in the log in transmission data class are written to the account number of the cloud platform
dto.Password = "aaaaaaaaaa";// Write the cloud platform password to the variables in the login transport class
dto.IsRememberMe = true;//rememberMe
Data = api.UserLogin (dto);// Exchange for Token
if (Data.IsSuccess ())
{
// Parsing returns Json data , extract Token token
Token = Data.ResultObj.AccessToken;
}
// get data , equipment ID、 Sensor identification name api, Login token (Token)
Data = api.GetSensorInfo (173736, "z_humidity", Token);
// sensorData Data coming through
string SensorData = Data.ResultObj.Value.ToString ();// If the value is not obtained, an error will be reported here !
value = SensorData;
}
// Button event
private void bt_get_Click (object sender, RoutedEventArgs e)
{
// Give Way label Display the value obtained
label.Content = value;
}
}
To learn more about linking cloud platforms, please click here :link
I could have endured the darkness , If I have never seen light
But now , The sun makes my loneliness more desolate .
版权声明
本文为[Xiaoye is stupid!]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230606586735.html
边栏推荐
猜你喜欢
随机推荐
Abnormal record-22
Abnormal record-12
Abnormal record-11
[Andorid] 通过JNI实现kernel与app进行spi通讯
BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
Dolphinscheduler配置Datax踩坑记录
一款png生成webp,gif, apng,同时支持webp,gif, apng转化的工具iSparta
oracle存储过程中is和as区别
oracle表空间表分区详解及oracle表分区查询使用方法
./gradlew: Permission denied
JNI中使用open打开文件是返回-1问题
oracle表的约束详解
oracle中生成32位uuid
BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
iTOP4412 SurfaceFlinger(4.0.3_r1)
oracle分区的相关操作
useReducer基本用法
pg库对姓名进行校验
[exynos4412] [itop4412] [android-k] add product options
iTOP4412 HDMI显示(4.0.3_r1)









