中国移动物联网平台数据转发 c# 控制台程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Timers;
using System.Data;
using Newtonsoft;
using System.Threading.Tasks;
using System.Net.Sockets;
using OneNET.Api;
using OneNET.Api.Entity;
using OneNET.Api.Request; namespace Tlink_Send
{
class Program
{ private const string url = "api.heclouds.com";
private const string appkey = "xxxxxxxxxx";//您在OneNET平台的APIKey static void Main(string[] args)
{
Console.WriteLine("江苏xx电气公司OPC-中国移动物联网平台转发工具");
//Console.ReadKey();
System.Timers.Timer maxTimer = new System.Timers.Timer();
maxTimer.Elapsed += new ElapsedEventHandler(Tmr_Elapsed);
// 设置引发时间的时间间隔 此处设置为1秒(1000毫秒)
maxTimer.Interval = ;
maxTimer.Enabled = true; //Console.WriteLine(album.ToString());
System.Threading.Thread.Sleep();
Console.ReadKey(); } static void Tmr_Elapsed(object sender, ElapsedEventArgs e)
{
string value1 = (System.DateTime.Now.Millisecond - ).ToString();
string value2 = (System.DateTime.Now.Millisecond - ).ToString();
string value3 = (System.DateTime.Now.Millisecond ).ToString();
string message=""; var client = new DefaultOneNETClient(url, appkey, "");
var streams = new List<DataStreamSimple>
{
new DataStreamSimple
{
ID = "1#污水PH值",//你在平台的数据流id
Datapoints = new List<DataPointSimple>
{
new DataPointSimple {Value = value1}
}
},
new DataStreamSimple
{
ID = "2#污水电导率",//你在平台的数据流id
Datapoints = new List<DataPointSimple>{
new DataPointSimple
{
Value = new {yyy = value1, zzz = value2, aaa = value3}
}
}
}
}; var data = new NewDataPointData { DataStreams = streams };
var req = new NewDataPointRequest { DeviceID = , Data = data };//你在平台的设备id
var rsp = client.Execute(req); Console.WriteLine("上传成功,上传值为" + value1 + " " + value2 + " " + value3);
Console.ReadKey();
}
} }
中国移动物联网平台数据转发 c# 控制台程序的更多相关文章
- 万物云平台数据转发 c# 控制台程序
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...
- tlink平台数据转发 c# 控制台程序
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...
- 利用irc服务器做物联网数据转发 c# winform程序
利用irc协议的优点: 免费,不用购买服务器就可以实现稳定公网转发数据 开源,irc的客户端和开源库众多,省去了自己造轮子的时间 历史悠久,互联网诞生伊始就有irc 缺点:安全性比较差 简单协议接收可 ...
- ESP8266上报数据到中国移动物联网平台HTTP
#include <HttpPacket.h> #include <ArduinoJson.h> #include <ESP8266WiFi.h> HttpPack ...
- 中国移动物联网ONENET平台数据本地采集工具
吧从中国移动物联网平台上接收的数据 实时按天保存为CSV文件或者是SQL SERVER数据库中方便进行数据处理 还可设置显示最大值,最小值,报警值,报警推送,tts语音报警等贴心功能
- HelloX操作系统与中国移动OneNET物联网平台成功完成对接
HelloX成功与中国移动物联网平台对接 经过HelloX项目组同仁的努力,尤其是Tywin(@飓风)的努力下,HelloX最新版本V1.78已成功与中国移动OneNET(open.iot.10086 ...
- 《图解HTTP》读书笔记(七:通信数据转发程序-代理/网关/隧道)
HTTP通信时,除客户端和服务器以外,还有一些用于通信数据转发的应用程序,例如代理.网关和隧道,它们可以配合服务器工作.这些服务器和应用程序可以将请求转发给通信线路上的下一站服务器,并且能接收从那台服 ...
- HTTP_5_通信数据转发程序:代理、网关、隧道
HTTP通信时,除客户端和服务器之外,还有一些用于通信数据转发的应用程序,例如代理,网关,隧道.配合服务器工作. 代理 转发功能,客户端与服务器之间可有多个代理, 缓存代理:减少服务器压力,透明代理: ...
- 【小程序案例】支付宝小程序-MQTT模器,IoT设备通过WSS接入阿里云IoT物联网平台
支付宝小程序-MQTT模拟器通过WSS接入阿里云IoT物联网平台 小程序效果: 1. 准备工作 1.1 注册阿里云账号 开通阿里云账号,并通过支付宝实名认证 https://www.aliyun.co ...
随机推荐
- Java并发集合(二)-ConcurrentSkipListMap分析和使用
一.ConcurrentSkipListMap介绍 ConcurrentSkipListMap是线程安全的有序的哈希表,适用于高并发的场景.ConcurrentSkipListMap和TreeMap, ...
- txt写入时报错出现:正由另一进程使用,原来是多此一举的操作
//if (!File.Exists(newfilepath + "\\" + name + num + ".txt")) //{ // File.Create ...
- Oracle_SQL(2) 分组与聚合函数
一.聚合函数1.定义:对表或视图的查询时,针对多行记录只返回一个值的函数.2.用途:用于select语句,HAVING条件二.5种聚合函数1.SUM(n) 对列求和 select sum(sal) f ...
- 初学者的分布式Python爬虫教程
下面是一个超级计算机的排行榜,如果我们能拥有其中任意一个,那么我们就不需要搞什么分布式系统.可是我们买不起,即使买得起,也交不起电费,所以我们只好费脑子搞分布式. 分布式的本质就如上期提到的一个概念: ...
- export export defalut
require/exports 和 import/export 形式不一样 require/exports 的用法只有以下三种简单的写法: const fs = require('fs') expor ...
- 第一个ASP.NET Web API (C#)程序
本文翻自http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api 绝对手工制作,如有雷同,实属巧合. 转载请注明. ...
- How to make a USB stick use ISO image file in debian
4.3.1. Preparing a USB stick using a hybrid CD or DVD image Debian CD and DVD images can now be writ ...
- [Selenium Grid] 搭建Hub和Node环境
Note : 先在Hub和Node的机器上安装好JDK, IE浏览器,Chrome浏览器,Firefox浏览器 准备好红色框标示的东西: Hub.bat :启动Hub AllNodes.bat : ...
- Python 常用模块之re 正则表达式的使用
re模块用来使用正则表达式.正则表达式用来对字符串进行搜索的工作.我们最应该掌握正则表达式的查询,更改,删除的功能.特别是做爬虫的时候,re模块就显得格外重要. 1.查询 import re a = ...
- Spring Boot学习笔记:kafka应用
Kafka作为众多Java消息中间件之一,有诸多优点.本文讲解Kafka的应用.学习一个新的知识点,建议先找一个demo,越简单越好的demo,跑通这个demo,了解大致原理,然后在分析细节,详细了解 ...