1 Star 1 Fork 0

梁陈洲/JAVA-HTTP-SDK

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

JAVA-HTTP-SDK

OneNET JAVA-HTTP-SDK 本项目是 中移物联网公司 为方便Java开发者接入 OneNET 平台而开发的SDK。关于OneNET请进入OneNet 主站了解详情。如果要了解OneNet API请进入 文档中心 参考API文档。 本程序是中移物联的OneNET公众版Java版本的SDK(完整版本)。Java SDK版本为1.5以上,maven版本为Apache Maven 3.3.9。 本SDK包含了OneNET平台的设备、数据流、数据点、触发器和api key的增删改查,以及二进制数据存取、命令执行、Mqtt相关功能。

本程序一共包含SDK代码和其单元测试(cmcc.iot.onenet.javasdk.ApiTest.java)。SDK使用案例请直接参照单元测试即可。

如何使用

示例

以设备新增为例

    public void testAdddevices() {
		String key = "9ylHzkz25nre41i=SuJR=F=k5kU=";
		String title = "devices_test";  
		String desc = "devices_test"; 
		String protocol = "HTTP"; 
		Location location =new Location(106,29,370);//设备位置{"纬度", "经度", "高度"}(可选)
		List<String> tags = new ArrayList<String>();  
		tags.add("china");
		tags.add("mobile");
		String auth_info = "201503041a5829151";   
		/****
		 * 设备新增
		 * 参数顺序与构造函数顺序一致
		 * @param title: 设备名,String
		 * @param protocol: 接入协议(可选,默认为HTTP),String
		 * @param desc: 设备描述(可选),String
		 * @param tags: 设备标签(可选,可为一个或多个),List<String>
		 * @param location: 设备位置{"纬度", "精度", "高度"}(可选),Location类型
		 * @param isPrivate: 设备私密性,Boolean类型(可选,默认为ture)
		 * @param authInfo: 设备唯一编号 ,Object
		 * @param other: 其他信息,Map<String, Object>
		 *	(可选,可自定义)	
		 * @param interval: MODBUS设备 下发命令周期,Integer类型,秒(可选)
		 * @param key: masterkey,String
		 */
		AddDevicesApi api = new AddDevicesApi(title, protocol, desc, tags, location, null, auth_info, null, null, key);
		BasicResponse<NewDeviceResponse> response = api.executeApi();
		System.out.println("errno:"+response.errno+" error:"+response.error);
		System.out.println(response.getJson());
		
	}

注意事项:

更多示例请参考ApiTest中的代码,运行前请确认resources中的config.properties请求的IP地址正确

MIT License Copyright (c) 2017 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

OneNET JAVA-HTTP-SDK 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/laolianglovecode/JAVA-HTTP-SDK.git
git@gitee.com:laolianglovecode/JAVA-HTTP-SDK.git
laolianglovecode
JAVA-HTTP-SDK
JAVA-HTTP-SDK
master

搜索帮助

371d5123 14472233 46e8bd33 14472233