#endif
char *gResourceUri= (char *)"/a/light";
-const char *dateOfManufacture = "myDateOfManufacture";
+const char *dateOfManufacture = "2016-01-15";
const char *deviceName = "myDeviceName";
-const char *deviceUUID = "myDeviceUUID";
+const char *deviceUUID = "51b55ddc-ccbb-4cb3-a57f-494eeca13a21";
const char *firmwareVersion = "myFirmwareVersion";
const char *manufacturerName = "myName";
const char *operatingSystemVersion = "myOS";
const char *hardwareVersion = "myHardwareVersion";
-const char* platformID = "myPlatformID";
-const char *manufacturerUrl = "myManufacturerUrl";
+const char *platformID = "0A3E0D6F-DBF5-404E-8719-D6880042463A";
+const char *manufacturerLink = "https://www.iotivity.org";
const char *modelNumber = "myModelNumber";
const char *platformVersion = "myPlatformVersion";
-const char *supportUrl = "mySupportUrl";
+const char *supportLink = "https://www.iotivity.org";
const char *version = "myVersion";
const char *systemTime = "2015-05-15T11.04";
-const char *specVersion = "myDeviceSpecVersion";
-const char *dataModelVersions = "myDeviceModelVersions";
+const char *specVersion = "core.1.1.0";
+const char *dataModelVersions = "res.1.1.0,sh.1.1.0";
// Entity handler should check for resourceTypeName and ResourceInterface in order to GET
// the existence of a known resource
}
}
+ OCPayloadDestroy(response.payload);
return ehResult;
}
MAX_HEADER_OPTION_DATA_LENGTH);
}
}
- OCHeaderOption * sendOptions = response.sendVendorSpecificHeaderOptions;
- uint8_t option2[] = {21,22,23,24,25,26,27,28,29,30};
- uint8_t option3[] = {31,32,33,34,35,36,37,38,39,40};
- sendOptions[0].protocolID = OC_COAP_ID;
- sendOptions[0].optionID = 2248;
- memcpy(sendOptions[0].optionData, option2, sizeof(option2));
- sendOptions[0].optionLength = 10;
- sendOptions[1].protocolID = OC_COAP_ID;
- sendOptions[1].optionID = 2600;
- memcpy(sendOptions[1].optionData, option3, sizeof(option3));
- sendOptions[1].optionLength = 10;
+
+ OCHeaderOption* sendOptions = response.sendVendorSpecificHeaderOptions;
+ size_t numOptions = response.numSendVendorSpecificHeaderOptions;
+ // Check if the option header has already existed before adding it in.
+ uint8_t optionData[MAX_HEADER_OPTION_DATA_LENGTH];
+ size_t optionDataSize = sizeof(optionData);
+ uint16_t actualDataSize = 0;
+ OCGetHeaderOption(response.sendVendorSpecificHeaderOptions,
+ response.numSendVendorSpecificHeaderOptions,
+ 2248,
+ optionData,
+ optionDataSize,
+ &actualDataSize);
+ if (actualDataSize == 0)
+ {
+ uint8_t option2[] = {21,22,23,24,25,26,27,28,29,30};
+ uint16_t optionID2 = 2248;
+ size_t optionDataSize2 = sizeof(option2);
+ OCSetHeaderOption(sendOptions,
+ &numOptions,
+ optionID2,
+ option2,
+ optionDataSize2);
+ }
+
+ OCGetHeaderOption(response.sendVendorSpecificHeaderOptions,
+ response.numSendVendorSpecificHeaderOptions,
+ 2600,
+ optionData,
+ optionDataSize,
+ &actualDataSize);
+ if (actualDataSize == 0)
+ {
+ uint8_t option3[] = {31,32,33,34,35,36,37,38,39,40};
+ uint16_t optionID3 = 2600;
+ size_t optionDataSize3 = sizeof(option3);
+ OCSetHeaderOption(sendOptions,
+ &numOptions,
+ optionID3,
+ option3,
+ optionDataSize3);
+ }
response.numSendVendorSpecificHeaderOptions = 2;
}
bool success = true;
- if(manufacturerName != NULL && (strlen(manufacturerName) > MAX_MANUFACTURER_NAME_LENGTH))
+ if(manufacturerName != NULL && (strlen(manufacturerName) > MAX_PLATFORM_NAME_LENGTH))
{
return OC_STACK_INVALID_PARAM;
}
- if(manufacturerUrl != NULL && (strlen(manufacturerUrl) > MAX_MANUFACTURER_URL_LENGTH))
+ if(manufacturerUrl != NULL && (strlen(manufacturerUrl) > MAX_PLATFORM_URL_LENGTH))
{
return OC_STACK_INVALID_PARAM;
}
OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandlerCb, NULL);
OCStackResult registrationResult =
- SetPlatformInfo(platformID, manufacturerName, manufacturerUrl, modelNumber,
+ SetPlatformInfo(platformID, manufacturerName, manufacturerLink, modelNumber,
dateOfManufacture, platformVersion, operatingSystemVersion, hardwareVersion,
- firmwareVersion, supportUrl, systemTime);
+ firmwareVersion, supportLink, systemTime);
if (registrationResult != OC_STACK_OK)
{