1 Star 0 Fork 0

iot_open / staging_stm32

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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);

至此移植完成

About

Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
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

Search