Fetch the repository succeeded.
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);
至此移植完成
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。