#include <signal.h>
#include <ocstack.h>
#include <logger.h>
+#include "oic_string.h"
+#include "oic_malloc.h"
#define TAG "IoTivityZigbeeServer"
#define defaultComPort "/dev/ttyUSB0"
+
+#define VERIFY_SUCCESS(op) \
+{ \
+ if (op != OC_STACK_OK) \
+ { \
+ OIC_LOG_V(FATAL, TAG, "%s failed!!", #op); \
+ goto exit; \
+ } \
+}
+
int main()
{
OIC_LOG(INFO, TAG, "Initializing IoTivity...");
OCStackResult SetDeviceInfo()
{
- static const OCDeviceInfo deviceInfo =
- {
- .deviceName = "IoTivity/Zigbee Server Sample"
- };
+ VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME,
+ "IoTivity/Zigbee Server Sample"));
+
+ VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION,
+ "IoTivity/Zigbee Device Spec Version"));
+
+ VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+ "IoTivity/Zigbee Data Model Version"));
+
+ OIC_LOG(INFO, TAG, "Device information initialized successfully.");
+ return OC_STACK_OK;
+
+exit:
+ return OC_STACK_ERROR;
- return OCSetDeviceInfo(deviceInfo);
}
bool processSignal(bool set)
processSignal(true);
}
}
-