* OCMode.
*
* @param[in] timeout Timeout in seconds, value till which function will listen to responses from
- * client before returning the list of devices.
+ * server before returning the list of devices.
* @param[out] ppList List of candidate devices to be provisioned
* @return OTM_SUCCESS in case of success and other value otherwise.
*/
* all the device in subnet which are owned by calling provisioning client.
*
* @param[in] timeout Timeout in seconds, value till which function will listen to responses from
- * client before returning the list of devices.
+ * server before returning the list of devices.
* @param[out] ppList List of device owned by provisioning tool.
* @return OTM_SUCCESS in case of success and other value otherwise.
*/
{
if(NULL == callbackData)
{
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_CALLBACK ;
}
return OTMSetOwnershipTransferCallbackData(oxm, callbackData);
{
return OC_STACK_INVALID_PARAM;
}
-
+ if (!resultCallback)
+ {
+ OIC_LOG(INFO, TAG, "OCDoOwnershipTransfer : NULL Callback");
+ return OC_STACK_INVALID_CALLBACK;
+ }
return OTMDoOwnershipTransfer(ctx, targetDevices, resultCallback);
}
}
/**
+ * this function requests CRED information to resource.
+ *
+ * @param[in] ctx Application context would be returned in result callback.
+ * @param[in] selectedDeviceInfo Selected target device.
+ * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
+ request recieves a response from resource server.
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,
+ OCProvisionResultCB resultCallback)
+{
+ return SRPGetCredResource(ctx, selectedDeviceInfo, resultCallback);
+}
+
+/**
+ * this function requests ACL information to resource.
+ *
+ * @param[in] ctx Application context would be returned in result callback.
+ * @param[in] selectedDeviceInfo Selected target device.
+ * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
+ request recieves a response from resource server.
+ * @return OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo,
+ OCProvisionResultCB resultCallback)
+{
+ return SRPGetACLResource(ctx, selectedDeviceInfo, resultCallback);
+}
+
+/**
* function to provision credential to devices.
*
* @param[in] ctx Application context would be returned in result callback.
OCUuidList_t* idList = NULL;
size_t numOfDev = 0;
- if (!pTargetDev1 || !pTargetDev2 || !resultCallback)
+ if (!pTargetDev1 || !pTargetDev2 || !pTargetDev1->doxm || !pTargetDev2->doxm)
{
OIC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters");
return OC_STACK_INVALID_PARAM;
}
+ if (!resultCallback)
+ {
+ OIC_LOG(INFO, TAG, "OCUnlinkDevices : NULL Callback");
+ return OC_STACK_INVALID_CALLBACK;
+ }
+ if (0 == memcmp(&pTargetDev1->doxm->deviceID, &pTargetDev2->doxm->deviceID, sizeof(OicUuid_t)))
+ {
+ OIC_LOG(INFO, TAG, "OCUnlinkDevices : Same device ID");
+ return OC_STACK_INVALID_PARAM;
+ }
// Get linked devices with the first device.
OCStackResult res = PDMGetLinkedDevices(&(pTargetDev1->doxm->deviceID), &idList, &numOfDev);
{
OIC_LOG(INFO, TAG, "IN OCRemoveDevice");
OCStackResult res = OC_STACK_ERROR;
- if (!pTargetDev || !resultCallback || 0 == waitTimeForOwnedDeviceDiscovery)
+ if (!pTargetDev || 0 == waitTimeForOwnedDeviceDiscovery)
{
OIC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters");
return OC_STACK_INVALID_PARAM;
}
+ if (!resultCallback)
+ {
+ OIC_LOG(INFO, TAG, "OCRemoveDevice : NULL Callback");
+ return OC_STACK_INVALID_CALLBACK;
+ }
// Send DELETE requests to linked devices
OCStackResult resReq = OC_STACK_ERROR; // Check that we have to wait callback or not.
OCProvisionResultCB resultCallback)
{
- if (!pDev1 || !pDev2 || !resultCallback)
+ if (!pDev1 || !pDev2 || !pDev1->doxm || !pDev2->doxm)
{
OIC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters");
return OC_STACK_INVALID_PARAM;
}
+ if (!resultCallback)
+ {
+ OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : NULL Callback");
+ return OC_STACK_INVALID_CALLBACK;
+ }
if (!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256))
{
OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size");
return OC_STACK_INVALID_PARAM;
}
+ if (0 == memcmp(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, sizeof(OicUuid_t)))
+ {
+ OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Same device ID");
+ return OC_STACK_INVALID_PARAM;
+ }
OIC_LOG(DEBUG, TAG, "Checking link in DB");
bool linkExists = true;