1 Star 0 Fork 0

iot_open / staging_stm32

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
dobbinsoft 提交于 2020-07-26 21:36 . [doc] readme

staging_stm32

介绍

staging_stm32 是 IoTechn 云平台stm32 demo代码,您可以直接在此工程上开发自己的项目,或者将IoTechn模块移植到您自己的工程中。

移植方法

1.将项目根目录中Iotechn文件夹复制到您的工程

2.在keil中新建一个Source Group,并将Iotechn中的C文件加入到该Source Group

3.在Target配中,添加Iotechn文件夹为头文件查找文件夹

4.1.在main.c头部加入函数声明

void onCommand(Command *command);
void onInvokeRes(InvokeRes *invokeRes);

4.2.在main.c中加入回调函数

void onCommand(Command *command)
{
	// 当命令来到时会进入此函数
	char *cmd = command->cmd;
	printf("%s\r\n",cmd);
	if (command->paramCount > 0)
	{
		for (uint8_t i = 0; i < command->paramCount; i++)
		{
			printf("param: %s, value: %s\r\n", command->params[i].name, command->params[i].valuestring);
		}
	}
}

void onInvokeRes(InvokeRes *invokeRes)
{	
	// API调用完成后
	if (str_equals(invokeRes->invokeId, "time"))
	{
		// 若是
		InvokeResItem *items = invokeRes->items;
		uint8_t count = invokeRes->itemCount;
		for (uint8_t i = 0; i < count; i++)
		{
			InvokeResItem item = items[i];
			printf("The %s is %d\r\n", item.name, item.valueint);
		}
	}
}

4.3.在main函数中初始化

IOT_Init(onCommand, onInvokeRes);

至此移植完成

C
1
https://gitee.com/iot_open/staging_stm32.git
git@gitee.com:iot_open/staging_stm32.git
iot_open
staging_stm32
staging_stm32
master

搜索帮助