c - 使用 json 在 ibmiot cloud 中发布事件

标签 c json ibm-cloud watson-iot

我想使用c语言将加速度计数据发送到IBM iot cloud。

在此我使用 json 格式在云中发布事件。

char *data="{\"d\": {\"x\": 43 }}";//工作正常..

我想通过这个指针以 JSON 格式发送即时值。请帮助我如何在 IBMIOTf 客户端使用 JSON 格式发送即时值

最佳答案

如果您使用 IBMIOTfclient (iotfclient.h),您可以调用 publishEvent,例如:

publishEvent(&client, "accel","json", "{\"d\": {\"x\": 43 }}", QOS0);

github中有一个示例.

关于c - 使用 json 在 ibmiot cloud 中发布事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43042436/

相关文章:

javascript - 按对象内部的值对数组对象进行 Angular 排序

java - 尝试调用 Watson Translation Service

c++ - printf 的用户定义函数

c - 为什么允许 `typedef struct x x`?

c++ - while循环中的除法

json - Play ScalaJSON Reads[T] 解析 ValidationError(error.path.missing,WrappedArray())

c - 如何修复不完整的结构类型

json - 冷融合9 : Using serializeJson on Hibernate entity encodes numeric properties as strings

apache-kafka - 客户端 ID 身份验证不再适用于 Kafka API

node.js - 带有 mailgun 适配器的解析服务器 - 我怎样才能让验证电子邮件工作?