当前位置:网站首页>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
边栏推荐
猜你喜欢

this.getOptions is not a function

Android面试计网面经大全【持续更新中。。。】

Build a cloud blog based on ECS (polite experience)

PG SQL截取字符串到指定字符位置

OSS云存储管理实践(体验有礼)

Itop4412 HDMI display (4.0.3_r1)

10g数据库使用大内存主机时不能启动的问题

ACFS文件系统创建扩大缩小等配置步骤

Build an OSS based image sharing website - polite feedback

BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
随机推荐
开篇:双指针仪表盘的识别
oracle对表字段的修改
Antd Design Form表单检验
【机器学习】笔记 4、KNN+交叉验证
Exception record-9
org.xml.sax.SAXParseException; lineNumber: 141; columnNumber: 252; cvc-complex-type.2.4.a: 发现了以元素 ‘b
timestamp隐式转换问题导致索引列未使用问题分析
oracle通过触发器和序列来定义自增主键,并且设置定时任务每秒钟插入一条数据到目标表
Recyclerview 批量更新View:notifyItemRangeInserted、notifyItemRangeRemoved、notifyItemRangeChanged
ACFS文件系统创建扩大缩小等配置步骤
this. getOptions is not a function
JNI中使用open打开文件是返回-1问题
19C RAC修改VIP及SCANIP步骤-同网段
发布自定义插件到本地服务器
同时解决高度塌陷和外边距重叠问题
iTOP4412 HDMI显示(4.0.3_r1)
oracle用delete删除数据所需时间测试
npm ERR code 500解决
10g数据库使用大内存主机时不能启动的问题
Bottomsheetdialogfragment conflicts with listview recyclerview Scrollview sliding