当前位置:网站首页>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
边栏推荐
猜你喜欢
【机器学习】笔记 4、KNN+交叉验证
从0开始封装一套项目的网络请求框架
ViewPager2实现画廊效果执行notifyDataSetChanged后PageTransformer显示异常 界面变形问题
Build a cloud blog based on ECS (polite experience)
Binder机制原理
基于BottomNavigationView实现底部导航栏
Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理
Android清除应用缓存
实习做了啥
oracle undo使用率高问题处理
随机推荐
ProcessBuilder工具类
js时间获取本周一、周日,判断时间是今天,今天前、后
oracle给对象重命名
ARGB透明度换算
BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
基于BottomNavigationView实现底部导航栏
oracle 修改默认临时表空间
ORACLE表有逻辑坏块时EXPDP导出报错排查
Abnormal record-11
ACFS文件系统创建扩大缩小等配置步骤
Component learning
Static interface method calls are not supported at language level ‘5‘ 异常解决
组件化学习
Cause: dx.jar is missing
MySQL笔记5_操作数据
iTOP4412无法显示开机动画(4.0.3_r1)
Android room database quick start
useReducer基本用法
通过rownum来进行区间查询
常用UI控件简写名