Set to __stdcall for WIN32.
Add to IPCA public APIs.
Other public APIs will be updated in separate commit.
Change-Id: I3201b7088eeb2227d2681847d20172825fbf4cae
Signed-off-by: Soemin Tjong <stjong@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18169
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Way Vadhanasin <wayvad@microsoft.com>
Reviewed-by: Mike Fenelon <mike.fenelon@microsoft.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18847
* + Property ("x.oem.DisplayBackground", type: string, access: read-write)
*/
+#ifdef OC_CALL
+# define IPCA_CALL OC_CALL
+#else
+# ifdef _WIN32
+ /*
+ * Set to __stdcall for Windows, consistent with WIN32 APIs.
+ */
+# define IPCA_CALL __stdcall
+# else
+# define IPCA_CALL
+# endif
+#endif
+
/**
* Handle types returned by IPCA.
*/
uint8_t uuid[16];
};
-// @todo: determine if this needs to map to __stdcall.
-// On x86 this causes the following run time failure.
-// "Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.
-// This is usually a result of calling a function declared with one calling convention with a
-// function pointer declared with a different calling convention."
-#define IPCA_CALL
-
/**
* Some information about the device from device discovery.
* Use IPCAGetDeviceInfo() for detailed device information.
* Use IPCAPropertyBag APIs to retrieve the values indexed by keys.
* propertyBagHandle is only valid during this callback.
*/
-typedef void (IPCA_CALL *IPCAResourceChangeCallback)(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle);
+typedef void (IPCA_CALL *IPCAResourceChangeCallback)(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle);
/**
* Callback from IPCA to application when device responds to IPCAGetProperties().
* Use IPCAPropertyBag APIs to retrieve the values indexed by keys.
* propertyBagHandle is only valid during this callback.
*/
-typedef void (IPCA_CALL *IPCAGetPropertiesComplete)(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle);
+typedef void (IPCA_CALL *IPCAGetPropertiesComplete)(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle);
/**
* Callback from IPCA to application when device responds to IPCASetProperties().
*
* Use IPCAPropertyBag APIs to retrieve the values indexed by keys.
* propertyBagHandle is only valid during this callback.
*/
-typedef void (IPCA_CALL *IPCASetPropertiesComplete)(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle);
+typedef void (IPCA_CALL *IPCASetPropertiesComplete)(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle);
/**
* Callback from IPCA to application when device responds to IPCACreateResource().
* propertyBagHandle is only valid during this callback.
*
*/
-typedef void (IPCA_CALL *IPCACreateResourceComplete)(IPCAStatus result,
- void* context,
- const char* newResourcePath,
- IPCAPropertyBagHandle propertyBagHandle);
+typedef void (IPCA_CALL *IPCACreateResourceComplete)(
+ IPCAStatus result,
+ void* context,
+ const char* newResourcePath,
+ IPCAPropertyBagHandle propertyBagHandle);
/**
* Callback from IPCA to application when device responds to IPCADeleteResource().
*/
typedef void (IPCA_CALL *IPCADiscoverDeviceCallback)(
- void* context,
- IPCADeviceStatus deviceStatus,
- const IPCADiscoveredDeviceInfo* discoveredDeviceInfo);
+ void* context,
+ IPCADeviceStatus deviceStatus,
+ const IPCADiscoveredDeviceInfo* discoveredDeviceInfo);
/**
* An application calls this method one time to register with IPCA.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCA_CALL IPCAOpen(const IPCAAppInfo* ipcaAppInfo,
- IPCAVersion ipcaVersion,
- IPCAAppHandle* ipcaAppHandle);
+IPCAStatus IPCA_CALL IPCAOpen(
+ const IPCAAppInfo* ipcaAppInfo,
+ IPCAVersion ipcaVersion,
+ IPCAAppHandle* ipcaAppHandle);
/**
* Close the handle returned in IPCAOpen().
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCA_CALL IPCADiscoverDevices(IPCAAppHandle ipcaAppHandle,
- IPCADiscoverDeviceCallback discoverDeviceCallback,
- void* context,
- const char* const* resourceTypeList,
- int resourceTypeCount,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCADiscoverDevices(
+ IPCAAppHandle ipcaAppHandle,
+ IPCADiscoverDeviceCallback discoverDeviceCallback,
+ void* context,
+ const char* const* resourceTypeList,
+ int resourceTypeCount,
+ IPCAHandle* handle);
/**
* Application indicates to IPCA the intention to start working with a device whose ID matches
* @return IPCA_OK if successful. IPCA_DEVICE_NOT_DISCOVERED if device is not yet discovered, call
* IPCADiscoverDevices().
*/
-IPCAStatus IPCA_CALL IPCAOpenDevice(IPCAAppHandle ipcaAppHandle,
- const char* deviceId,
- IPCADeviceHandle* deviceHandle);
+IPCAStatus IPCA_CALL IPCAOpenDevice(
+ IPCAAppHandle ipcaAppHandle,
+ const char* deviceId,
+ IPCADeviceHandle* deviceHandle);
/**
* Closes device handle. The application will stop receiving notifications and callbacks from the
* IPCA_INFORMATION_NOT_AVAILABLE if server has not returned the device info query.
* IPCA_INFO_VERSION_NOT_SUPPORTED when requested info version is not supported.
*/
-IPCAStatus IPCAGetDeviceInfo(IPCADeviceHandle deviceHandle, IPCADeviceInfo** deviceInfo);
+IPCAStatus IPCA_CALL IPCAGetDeviceInfo(IPCADeviceHandle deviceHandle, IPCADeviceInfo** deviceInfo);
/**
* Free the memory allocated in IPCAGetDeviceInfo().
*
* @param[in] deviceInfo a Pointer to IPCADeviceInfo structure returned in IPCAGetDeviceInfo().
*/
-void IPCAFreeDeviceInfo(IPCADeviceInfo* deviceInfo);
+void IPCA_CALL IPCAFreeDeviceInfo(IPCADeviceInfo* deviceInfo);
/**
* This method returns a pointer to IPCAPlatformInfo structure.
* IPCA_INFORMATION_NOT_AVAILABLE if server has not returned the platform info query.
* IPCA_INFO_VERSION_NOT_SUPPORTED when requested info version is not supported.
*/
-IPCAStatus IPCAGetPlatformInfo(IPCADeviceHandle deviceHandle, IPCAPlatformInfo** platformInfo);
+IPCAStatus IPCA_CALL IPCAGetPlatformInfo(
+ IPCADeviceHandle deviceHandle,
+ IPCAPlatformInfo** platformInfo);
/**
* Free the memory allocated in IPCAGetPlatformInfo().
* @param[in] platformInfo A pointer to IPCAPlatformInfo structure returned
* in IPCAGetPlatformInfo().
*/
-void IPCAFreePlatformInfo(IPCAPlatformInfo* platformInfo);
+void IPCA_CALL IPCAFreePlatformInfo(IPCAPlatformInfo* platformInfo);
/**
* Get the resources that implement resource types in IPCADiscoverDevices().
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCA_CALL IPCAGetResources(IPCADeviceHandle deviceHandle,
- const char* resourceInterface,
- const char* resourceType,
- char*** resourcePathList,
- size_t* resourcePathCount);
+IPCAStatus IPCA_CALL IPCAGetResources(
+ IPCADeviceHandle deviceHandle,
+ const char* resourceInterface,
+ const char* resourceType,
+ char*** resourcePathList,
+ size_t* resourcePathCount);
/**
* Get the list of resource types implemented by a resource.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCA_CALL IPCAGetResourceTypes(IPCADeviceHandle deviceHandle,
- const char* resourcePath,
- char*** resourceTypeList,
- size_t* resourceTypeCount);
+IPCAStatus IPCA_CALL IPCAGetResourceTypes(
+ IPCADeviceHandle deviceHandle,
+ const char* resourcePath,
+ char*** resourceTypeList,
+ size_t* resourceTypeCount);
/**
* Get the list of resource interfaces implemented by a resource.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCA_CALL IPCAGetResourceInterfaces(IPCADeviceHandle deviceHandle,
- const char* resourcePath,
- char*** resourceInterfaceList,
- size_t* resourceInterfaceCount);
+IPCAStatus IPCA_CALL IPCAGetResourceInterfaces(
+ IPCADeviceHandle deviceHandle,
+ const char* resourcePath,
+ char*** resourceInterfaceList,
+ size_t* resourceInterfaceCount);
/**
* Free string array returned in IPCAGetResources(), IPCAGetResourceTypes(),
*
* @return IPCA_OK if successful. IPCA calls getPropertiesComplete() when device responds.
*/
-IPCAStatus IPCA_CALL IPCAGetProperties(IPCADeviceHandle deviceHandle,
- IPCAGetPropertiesComplete getPropertiesComplete,
- void* context,
- const char* resourcePath,
- const char* resourceInterface,
- const char* resourceType,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCAGetProperties(
+ IPCADeviceHandle deviceHandle,
+ IPCAGetPropertiesComplete getPropertiesComplete,
+ void* context,
+ const char* resourcePath,
+ const char* resourceInterface,
+ const char* resourceType,
+ IPCAHandle* handle);
/**
* Set property values of a resource.
*
* @return IPCA_OK if successful. IPCA calls setPropertiesComplete() when device reponds.
*/
-IPCAStatus IPCA_CALL IPCASetProperties(IPCADeviceHandle deviceHandle,
- IPCASetPropertiesComplete setPropertiesComplete,
- void* context,
- const char* resourcePath,
- const char* resourceInterface,
- const char* resourceType,
- IPCAPropertyBagHandle propertyBagHandle,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCASetProperties(
+ IPCADeviceHandle deviceHandle,
+ IPCASetPropertiesComplete setPropertiesComplete,
+ void* context,
+ const char* resourcePath,
+ const char* resourceInterface,
+ const char* resourceType,
+ IPCAPropertyBagHandle propertyBagHandle,
+ IPCAHandle* handle);
/**
* Request device to create a new resource.
*
* @return IPCA_OK if successful. IPCA calls createResourceComplete() when device reponds.
*/
-IPCAStatus IPCA_CALL IPCACreateResource(IPCADeviceHandle deviceHandle,
- IPCACreateResourceComplete createResourceComplete,
- void* context,
- const char* resourceCollectionPath,
- const char* resourceInterface,
- const char* resourceType,
- IPCAPropertyBagHandle propertyBagHandle,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCACreateResource(
+ IPCADeviceHandle deviceHandle,
+ IPCACreateResourceComplete createResourceComplete,
+ void* context,
+ const char* resourceCollectionPath,
+ const char* resourceInterface,
+ const char* resourceType,
+ IPCAPropertyBagHandle propertyBagHandle,
+ IPCAHandle* handle);
/**
* Request device to delete a resource.
* @return IPCA_OK if successful. IPCA calls deleteResourceComplete() when device reponds.
*/
-IPCAStatus IPCA_CALL IPCADeleteResource(IPCADeviceHandle deviceHandle,
- IPCADeleteResourceComplete deleteResourceComplete,
- void* context,
- const char* resourcePath,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCADeleteResource(
+ IPCADeviceHandle deviceHandle,
+ IPCADeleteResourceComplete deleteResourceComplete,
+ void* context,
+ const char* resourcePath,
+ IPCAHandle* handle);
/**
* Function returns whether a resource is observable.
*
* @return IPCA_OK if successful.
*/
-void IPCA_CALL IPCAIsResourceObservable(IPCADeviceHandle deviceHandle,
- const char* resourcePath,
- bool* isObservable);
+void IPCA_CALL IPCAIsResourceObservable(
+ IPCADeviceHandle deviceHandle,
+ const char* resourcePath,
+ bool* isObservable);
/**
* Function to start observing a resource. Use IPCACloseHandle() to stop receiving resource change
* @return IPCA_OK if successful. IPCA calls resourceChangeCallback() when device sends
* notifications.
*/
-IPCAStatus IPCA_CALL IPCAObserveResource(IPCADeviceHandle deviceHandle,
- IPCAResourceChangeCallback resourceChangeCallback,
- void* context,
- const char* resourcePath,
- const char* resourceType,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCAObserveResource(
+ IPCADeviceHandle deviceHandle,
+ IPCAResourceChangeCallback resourceChangeCallback,
+ void* context,
+ const char* resourcePath,
+ const char* resourceType,
+ IPCAHandle* handle);
/**
* Stop receiving callbacks for the handle.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagCreate(IPCAPropertyBagHandle* propertyBagHandle);
+IPCAStatus IPCA_CALL IPCAPropertyBagCreate(IPCAPropertyBagHandle* propertyBagHandle);
/**
* Delete an IPCPropertyBag object.
* @param[in] propertyBagHandle Handle returned in IPCAPropertyBagCreate().
*/
-void IPCAPropertyBagDestroy(IPCAPropertyBagHandle propertyBagHandle);
+void IPCA_CALL IPCAPropertyBagDestroy(IPCAPropertyBagHandle propertyBagHandle);
/**
* Get the resource path of the property bag.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagGetResourcePath(IPCAPropertyBagHandle propertyBagHandle,
- char** resourcePath);
+IPCAStatus IPCA_CALL IPCAPropertyBagGetResourcePath(
+ IPCAPropertyBagHandle propertyBagHandle,
+ char** resourcePath);
/**
* Value type of a property in a property bag.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagGetAllKeyValuePairs(IPCAPropertyBagHandle propertyBagHandle,
- char*** keys,
- IPCAValueType** valueTypes,
- size_t* count);
+IPCAStatus IPCA_CALL IPCAPropertyBagGetAllKeyValuePairs(
+ IPCAPropertyBagHandle propertyBagHandle,
+ char*** keys,
+ IPCAValueType** valueTypes,
+ size_t* count);
/**
* Free memory allocated for IPCAValueType in IPCAPropertyBagGetAllKeyValuePairs().
* @param[in] valueArray Array of IPCAValueType values returned in
* IPCAPropertyBagGetAllKeyValuePairs().
*/
-void IPCAPropertyBagFreeIPCAValueTypeArray(IPCAValueType* valueArray);
+void IPCA_CALL IPCAPropertyBagFreeIPCAValueTypeArray(IPCAValueType* valueArray);
/**
* Set property value.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagSetValueInt(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int value);
-
-IPCAStatus IPCAPropertyBagSetValueDouble(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double value);
-
-IPCAStatus IPCAPropertyBagSetValueBool(IPCAPropertyBagHandle
- propertyBagHandle,
- const char* key,
- bool value);
-
-IPCAStatus IPCAPropertyBagSetValueString(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const char* value);
-
-IPCAStatus IPCAPropertyBagSetValuePropertyBag(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const IPCAPropertyBagHandle value);
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueInt(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueDouble(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueBool(
+ IPCAPropertyBagHandle
+ propertyBagHandle,
+ const char* key,
+ bool value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueString(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const char* value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValuePropertyBag(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const IPCAPropertyBagHandle value);
/**
* Set array value.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagSetValueIntArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const int* valueArray,
- size_t valueCount);
-
-IPCAStatus IPCAPropertyBagSetValueDoubleArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const double* valueArray,
- size_t valueCount);
-
-IPCAStatus IPCAPropertyBagSetValueBoolArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const bool* valueArray,
- size_t valueCount);
-
-IPCAStatus IPCAPropertyBagSetValueStringArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const char** valueArray,
- size_t valueCount);
-
-IPCAStatus IPCAPropertyBagSetValuePropertyBagArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const IPCAPropertyBagHandle* valueArray,
- size_t valueCount);
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueIntArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const int* valueArray,
+ size_t valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueDoubleArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const double* valueArray,
+ size_t valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueBoolArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const bool* valueArray,
+ size_t valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueStringArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const char** valueArray,
+ size_t valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValuePropertyBagArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const IPCAPropertyBagHandle* valueArray,
+ size_t valueCount);
/**
* Get property value.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagGetValueInt(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int* value);
-
-IPCAStatus IPCAPropertyBagGetValueDouble(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double* value);
-
-IPCAStatus IPCAPropertyBagGetValueBool(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- bool* value);
-
-IPCAStatus IPCAPropertyBagGetValueString(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- char** value);
-
-IPCAStatus IPCAPropertyBagGetValuePropertyBag(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- IPCAPropertyBagHandle* value);
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueInt(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int* value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueDouble(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double* value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueBool(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ bool* value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueString(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ char** value);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValuePropertyBag(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ IPCAPropertyBagHandle* value);
/**
* Get array value.
*
* @return IPCA_OK if successful.
*/
-IPCAStatus IPCAPropertyBagGetValueIntArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int** value,
- size_t* valueCount);
-
-IPCAStatus IPCAPropertyBagGetValueDoubleArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double** value,
- size_t* valueCount);
-
-IPCAStatus IPCAPropertyBagGetValueBoolArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- bool** value,
- size_t* valueCount);
-
-IPCAStatus IPCAPropertyBagGetValueStringArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- char*** value,
- size_t* valueCount);
-
-IPCAStatus IPCAPropertyBagGetValuePropertyBagArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- IPCAPropertyBagHandle** value,
- size_t* valueCount);
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueIntArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int** value,
+ size_t* valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueDoubleArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double** value,
+ size_t* valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueBoolArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ bool** value,
+ size_t* valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueStringArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ char*** value,
+ size_t* valueCount);
+
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValuePropertyBagArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ IPCAPropertyBagHandle** value,
+ size_t* valueCount);
/**
* Free array types.
*/
-void IPCAPropertyBagFreeIntArray(int* valueArray);
-void IPCAPropertyBagFreeDoubleArray(double* valueArray);
-void IPCAPropertyBagFreeBoolArray(bool* valueArray);
-void IPCAPropertyBagFreeStringArray(char** valueArray, size_t valueCount);
-void IPCAPropertyBagFreePropertyBagArray(IPCAPropertyBagHandle* valueArray, size_t valueCount);
+void IPCA_CALL IPCAPropertyBagFreeIntArray(int* valueArray);
+void IPCA_CALL IPCAPropertyBagFreeDoubleArray(double* valueArray);
+void IPCA_CALL IPCAPropertyBagFreeBoolArray(bool* valueArray);
+void IPCA_CALL IPCAPropertyBagFreeStringArray(char** valueArray, size_t valueCount);
+void IPCA_CALL IPCAPropertyBagFreePropertyBagArray(
+ IPCAPropertyBagHandle* valueArray,
+ size_t valueCount);
/**
* Free stringBuffer allocated in IPCAPropertyBagGetValueString().
*
* @param[in] stringBuffer String buffer returned in IPCAPropertyBagGetValueString().
*/
-void IPCAPropertyBagFreeString(char* stringBuffer);
+void IPCA_CALL IPCAPropertyBagFreeString(char* stringBuffer);
/**
* Security authentication type used during Ownership Transfer communication.
* argument in the password callbacks.
*
*/
-IPCAStatus IPCA_CALL IPCASetPasswordCallbacks(IPCAAppHandle ipcaAppHandle,
- IPCAProvidePasswordCallback providePasswordCallback,
- IPCADisplayPasswordCallback displayPasswordCallback,
- void* context);
+IPCAStatus IPCA_CALL IPCASetPasswordCallbacks(
+ IPCAAppHandle ipcaAppHandle,
+ IPCAProvidePasswordCallback providePasswordCallback,
+ IPCADisplayPasswordCallback displayPasswordCallback,
+ void* context);
/**
* Callback from IPCA when a request initiated by the application using IPCARequestAccess has been
* IPCA_SECURITY_UPDATE_REQUEST_FAILED.
* @param[in] context Applications's context set in IPCARequestAccess().
*/
-typedef void (IPCA_CALL *IPCARequestAccessCompletionCallback)(IPCAStatus completionStatus,
- void* context);
+typedef void (IPCA_CALL *IPCARequestAccessCompletionCallback)(
+ IPCAStatus completionStatus,
+ void* context);
/**
* Initiate a request to access a device. Called by the application after IPCAGetProperties or
* @return
* IPCA_OK if the request has been successfully initiated.
*/
-IPCAStatus IPCA_CALL IPCARequestAccess(IPCADeviceHandle deviceHandle,
- const char* resourcePath,
- IPCARequestAccessCompletionCallback completionCallback,
- void* context,
- IPCAHandle* handle);
+IPCAStatus IPCA_CALL IPCARequestAccess(
+ IPCADeviceHandle deviceHandle,
+ const char* resourcePath,
+ IPCARequestAccessCompletionCallback completionCallback,
+ void* context,
+ IPCAHandle* handle);
#ifdef __cplusplus
} /* extern "C" */
#endif
// Forward decls.
extern bool RediscoverElevator();
-extern void ResourceChangeNotificationCallback(IPCAStatus result, void* context,
- IPCAPropertyBagHandle propertyBagHandle);
+extern void IPCA_CALL ResourceChangeNotificationCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle);
// Key is device id. Value is pointer to OCFDevice.
std::map<std::string, OCFDevice::Ptr> g_OCFDeviceList;
}
// Callback from IPCAObserveResource().
-void ResourceChangeNotificationCallback(IPCAStatus result, void* context,
- IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL ResourceChangeNotificationCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
UNUSED_PARAMETER(context);
std::mutex g_getPropertiesCbMutex;
std::condition_variable g_getPropertiesCompleteCV;
-void GetPropertiesCallback(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL GetPropertiesCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
UNUSED_PARAMETER(context);
// IPCASetProperties() completion callback.
std::mutex g_setPropertiesCbMutex;
std::condition_variable g_setPropertiesCompleteCV;
-void SetPropertiesCallback(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL SetPropertiesCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
UNUSED_PARAMETER(context);
UNUSED_PARAMETER(propertyBagHandle);
// Callback when device is discovered.
std::mutex g_deviceDiscoveredCbMutex;
std::condition_variable g_deviceDiscoveredCV;
-void DiscoverDevicesCallback(void* context,
- IPCADeviceStatus deviceStatus,
- const IPCADiscoveredDeviceInfo* deviceInfo)
+void IPCA_CALL DiscoverDevicesCallback(
+ void* context,
+ IPCADeviceStatus deviceStatus,
+ const IPCADiscoveredDeviceInfo* deviceInfo)
{
UNUSED_PARAMETER(context);
return true;
}
-IPCAStatus PwdInputCallback(
- void* context,
- const IPCADeviceInfo* deviceInformation,
- const IPCAPlatformInfo* platformInformation,
- IPCAOwnershipTransferType type,
- char* passwordBuffer,
- size_t passwordBufferSize)
+IPCAStatus IPCA_CALL PwdInputCallback(
+ void* context,
+ const IPCADeviceInfo* deviceInformation,
+ const IPCAPlatformInfo* platformInformation,
+ IPCAOwnershipTransferType type,
+ char* passwordBuffer,
+ size_t passwordBufferSize)
{
UNUSED_PARAMETER(passwordBufferSize);
UNUSED_PARAMETER(type);
return IPCA_OK;
}
-IPCAStatus PwdDisplayCallback(
- void* context,
- const IPCADeviceInfo* deviceInformation,
- const IPCAPlatformInfo* platformInformation,
- IPCAOwnershipTransferType type,
- const char* password)
+IPCAStatus IPCA_CALL PwdDisplayCallback(
+ void* context,
+ const IPCADeviceInfo* deviceInformation,
+ const IPCAPlatformInfo* platformInformation,
+ IPCAOwnershipTransferType type,
+ const char* password)
{
UNUSED_PARAMETER(context);
UNUSED_PARAMETER(deviceInformation);
return IPCA_OK;
}
-void AuthCompletionCallback(IPCAStatus completionStatus, void* context)
+void IPCA_CALL AuthCompletionCallback(IPCAStatus completionStatus, void* context)
{
UNUSED_PARAMETER(context);
std::cout << "AuthCompletionCallback(). Completion status is: " << completionStatus;
return m_platformInfo;
}
-void C_GetPropertiesCallback(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL C_GetPropertiesCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
std::lock_guard<std::recursive_mutex> lock(g_globalMutex);
std::map<std::string, OCFDevice::Ptr> g_OCFDeviceList;
// Callback when device is discovered.
-void DiscoverDevicesCallback(void* context,
- IPCADeviceStatus deviceStatus,
- const IPCADiscoveredDeviceInfo* deviceInfo)
+void IPCA_CALL DiscoverDevicesCallback(
+ void* context,
+ IPCADeviceStatus deviceStatus,
+ const IPCADiscoveredDeviceInfo* deviceInfo)
{
UNUSED_PARAMETER(context);
ocfDevice->DisplayDevice();
}
-IPCAStatus IPCA_CALL PasswordInputCallback(void* context,
- const IPCADeviceInfo* deviceInformation,
- const IPCAPlatformInfo* platformInformation,
- IPCAOwnershipTransferType type,
- char* passwordBuffer,
- size_t passwordBufferSize)
+IPCAStatus IPCA_CALL PasswordInputCallback(
+ void* context,
+ const IPCADeviceInfo* deviceInformation,
+ const IPCAPlatformInfo* platformInformation,
+ IPCAOwnershipTransferType type,
+ char* passwordBuffer,
+ size_t passwordBufferSize)
{
UNUSED_PARAMETER(context);
UNUSED_PARAMETER(deviceInformation);
return IPCA_FAIL;
}
-IPCAStatus IPCA_CALL PasswordDisplayCallback(void* context,
- const IPCADeviceInfo* deviceInformation,
- const IPCAPlatformInfo* platformInformation,
- IPCAOwnershipTransferType type,
- const char* password)
+IPCAStatus IPCA_CALL PasswordDisplayCallback(
+ void* context,
+ const IPCADeviceInfo* deviceInformation,
+ const IPCAPlatformInfo* platformInformation,
+ IPCAOwnershipTransferType type,
+ const char* password)
{
UNUSED_PARAMETER(context);
UNUSED_PARAMETER(deviceInformation);
};
// Represent IPCAResourceChangeCallback, IPCAGetPropertiesComplete, IPCASetPropertiesComplete.
-typedef void (IPCA_CALL *GenericAppCallback)(IPCAStatus result,
- void* context,
- IPCAPropertyBagHandle propertyBagHandle);
+typedef void (IPCA_CALL *GenericAppCallback)(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle);
// One Callback object per App. One app per IPCAOpen().
class Callback
bool g_unitTestMode = false;
-IPCAStatus IPCA_CALL IPCAOpen(const IPCAAppInfo* ipcaAppInfo,
+IPCAStatus IPCA_CALL IPCAOpen(
+ const IPCAAppInfo* ipcaAppInfo,
IPCAVersion ipcaVersion,
IPCAAppHandle* ipcaAppHandle)
{
g_app = nullptr;
}
-IPCAStatus IPCA_CALL IPCADiscoverDevices(IPCAAppHandle ipcaAppHandle,
- IPCADiscoverDeviceCallback callback,
- void* context,
- const char* const* resourceTypeList,
- int resourceTypeCount,
- IPCAHandle* handle)
+IPCAStatus IPCA_CALL IPCADiscoverDevices(
+ IPCAAppHandle ipcaAppHandle,
+ IPCADiscoverDeviceCallback callback,
+ void* context,
+ const char* const* resourceTypeList,
+ int resourceTypeCount,
+ IPCAHandle* handle)
{
App* app = reinterpret_cast<App*>(ipcaAppHandle);
return app->DiscoverDevices(callback, context, resourceTypeList, resourceTypeCount, handle);
}
-IPCAStatus IPCA_CALL IPCAOpenDevice(IPCAAppHandle ipcaAppHandle,
- const char* deviceId,
- IPCADeviceHandle* deviceHandle)
+IPCAStatus IPCA_CALL IPCAOpenDevice(
+ IPCAAppHandle ipcaAppHandle,
+ const char* deviceId,
+ IPCADeviceHandle* deviceHandle)
{
App* app = reinterpret_cast<App*>(ipcaAppHandle);
return app->OpenDevice(deviceId, deviceHandle);
app->CloseDevice(deviceHandle);
}
-IPCAStatus IPCAGetDeviceInfo(IPCADeviceHandle deviceHandle, IPCADeviceInfo** deviceInfo)
+IPCAStatus IPCA_CALL IPCAGetDeviceInfo(IPCADeviceHandle deviceHandle, IPCADeviceInfo** deviceInfo)
{
DeviceWrapper* deviceWrapper = reinterpret_cast<DeviceWrapper*>(deviceHandle);
return deviceWrapper->device->GetDeviceInfo(deviceInfo);
}
-void IPCAFreeDeviceInfo(IPCADeviceInfo* deviceInfo)
+void IPCA_CALL IPCAFreeDeviceInfo(IPCADeviceInfo* deviceInfo)
{
OCFFramework::FreeDeviceInfo(deviceInfo);
}
-IPCAStatus IPCAGetPlatformInfo(IPCADeviceHandle deviceHandle, IPCAPlatformInfo** platformInfo)
+IPCAStatus IPCA_CALL IPCAGetPlatformInfo(IPCADeviceHandle deviceHandle,
+ IPCAPlatformInfo** platformInfo)
{
DeviceWrapper* deviceWrapper = reinterpret_cast<DeviceWrapper*>(deviceHandle);
return deviceWrapper->device->GetPlatformInfo(platformInfo);
}
-void IPCAFreePlatformInfo(IPCAPlatformInfo* platformInfo)
+void IPCA_CALL IPCAFreePlatformInfo(IPCAPlatformInfo* platformInfo)
{
OCFFramework::FreePlatformInfo(platformInfo);
}
-IPCAStatus IPCA_CALL IPCAGetResources(IPCADeviceHandle deviceHandle,
+IPCAStatus IPCA_CALL IPCAGetResources(
+ IPCADeviceHandle deviceHandle,
const char* resourceInterface,
const char* resourceType,
char*** resourcePathList,
handle);
}
-IPCAStatus IPCA_CALL IPCACreateResource(IPCADeviceHandle deviceHandle,
- IPCACreateResourceComplete createResourceCb,
- void* context,
- const char* resourcePath,
- const char* resourceInterface,
- const char* resourceType,
- IPCAPropertyBagHandle propertyBagHandle,
- IPCAHandle* handle)
+IPCAStatus IPCA_CALL IPCACreateResource(
+ IPCADeviceHandle deviceHandle,
+ IPCACreateResourceComplete createResourceCb,
+ void* context,
+ const char* resourcePath,
+ const char* resourceInterface,
+ const char* resourceType,
+ IPCAPropertyBagHandle propertyBagHandle,
+ IPCAHandle* handle)
{
DeviceWrapper* deviceWrapper = reinterpret_cast<DeviceWrapper*>(deviceHandle);
return deviceWrapper->app->CreateResource(
handle);
}
-IPCAStatus IPCA_CALL IPCADeleteResource(IPCADeviceHandle deviceHandle,
- IPCADeleteResourceComplete deleteResourceCb,
- void* context,
- const char* resourcePath,
- IPCAHandle* handle)
+IPCAStatus IPCA_CALL IPCADeleteResource(
+ IPCADeviceHandle deviceHandle,
+ IPCADeleteResourceComplete deleteResourceCb,
+ void* context,
+ const char* resourcePath,
+ IPCAHandle* handle)
{
DeviceWrapper* deviceWrapper = reinterpret_cast<DeviceWrapper*>(deviceHandle);
return deviceWrapper->app->DeleteResource(
IPCAStatus result;
} AsyncContext;
-void AsyncCallback(IPCAStatus result, void* context, IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL AsyncCallback(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
OC_UNUSED(propertyBagHandle);
return status;
}
-IPCAStatus IPCA_CALL IPCASetPasswordCallbacks(IPCAAppHandle ipcaAppHandle,
- IPCAProvidePasswordCallback inputCallback,
- IPCADisplayPasswordCallback displayCallback,
- void* context)
+IPCAStatus IPCA_CALL IPCASetPasswordCallbacks(
+ IPCAAppHandle ipcaAppHandle,
+ IPCAProvidePasswordCallback inputCallback,
+ IPCADisplayPasswordCallback displayCallback,
+ void* context)
{
App* app = reinterpret_cast<App*>(ipcaAppHandle);
return app->SetPasswordCallbacks(inputCallback, displayCallback, context);
}
-IPCAStatus IPCA_CALL IPCARequestAccess(IPCADeviceHandle deviceHandle,
- const char* resourcePath,
- IPCARequestAccessCompletionCallback completionCallback,
- void* context,
- IPCAHandle* handle)
+IPCAStatus IPCA_CALL IPCARequestAccess(
+ IPCADeviceHandle deviceHandle,
+ const char* resourcePath,
+ IPCARequestAccessCompletionCallback completionCallback,
+ void* context,
+ IPCAHandle* handle)
{
DeviceWrapper* deviceWrapper = reinterpret_cast<DeviceWrapper*>(deviceHandle);
return deviceWrapper->app->RequestAccess(
#define TAG "IPCA_Variant"
-IPCAStatus IPCAPropertyBagCreate(IPCAPropertyBagHandle* propertyBagHandle)
+IPCAStatus IPCA_CALL IPCAPropertyBagCreate(IPCAPropertyBagHandle* propertyBagHandle)
{
OC::OCRepresentation* rep = new OC::OCRepresentation();
return IPCA_OK;
}
-void IPCAPropertyBagDestroy(IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL IPCAPropertyBagDestroy(IPCAPropertyBagHandle propertyBagHandle)
{
delete(reinterpret_cast<OC::OCRepresentation*>(propertyBagHandle));
}
template <typename _T>
-IPCAStatus IPCAPropertySetValue(IPCAPropertyBagHandle propertyBagHandle, const char* key, _T value)
+IPCAStatus IPCA_CALL IPCAPropertySetValue(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ _T value)
{
if (propertyBagHandle == nullptr)
{
}
}
-IPCAStatus IPCAPropertyBagSetValueInt(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int value)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueInt(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int value)
{
return IPCAPropertySetValue(propertyBagHandle, key, value);
}
-IPCAStatus IPCAPropertyBagSetValueDouble(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double value)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueDouble(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double value)
{
return IPCAPropertySetValue(propertyBagHandle, key, value);
}
-IPCAStatus IPCAPropertyBagSetValueBool(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- bool value)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueBool(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ bool value)
{
return IPCAPropertySetValue(propertyBagHandle, key, value);
}
-IPCAStatus IPCAPropertyBagSetValueString(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const char* value)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueString(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const char* value)
{
std::string valueString = value;
return IPCAPropertySetValue(propertyBagHandle, key, valueString);
}
-IPCAStatus IPCAPropertyBagSetValuePropertyBag(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const IPCAPropertyBagHandle value)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValuePropertyBag(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const IPCAPropertyBagHandle value)
{
if (propertyBagHandle == nullptr)
{
}
template <typename _T>
-IPCAStatus IPCAPropertyBagSetValueArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const _T* valueArray,
- size_t arrayCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const _T* valueArray,
+ size_t arrayCount)
{
if (propertyBagHandle == nullptr)
{
}
}
-IPCAStatus IPCAPropertyBagSetValueIntArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const int* valueArray,
- size_t arrayCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueIntArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const int* valueArray,
+ size_t arrayCount)
{
return IPCAPropertyBagSetValueArray(propertyBagHandle, key, valueArray, arrayCount);
}
-IPCAStatus IPCAPropertyBagSetValueDoubleArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const double* valueArray,
- size_t arrayCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueDoubleArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const double* valueArray,
+ size_t arrayCount)
{
return IPCAPropertyBagSetValueArray(propertyBagHandle, key, valueArray, arrayCount);
}
-IPCAStatus IPCAPropertyBagSetValueBoolArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const bool* valueArray,
- size_t arrayCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueBoolArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const bool* valueArray,
+ size_t arrayCount)
{
return IPCAPropertyBagSetValueArray(propertyBagHandle, key, valueArray, arrayCount);
}
-IPCAStatus IPCAPropertyBagSetValueStringArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const char** valueArray,
- size_t arrayCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValueStringArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const char** valueArray,
+ size_t arrayCount)
{
if (propertyBagHandle == nullptr)
{
}
}
-IPCAStatus IPCAPropertyBagSetValuePropertyBagArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- const IPCAPropertyBagHandle* valueArray,
- size_t valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagSetValuePropertyBagArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ const IPCAPropertyBagHandle* valueArray,
+ size_t valueCount)
{
if (propertyBagHandle == nullptr)
{
}
template <typename _T>
-IPCAStatus AllocateAndCopyTypeVectorToArrayOfType(std::vector<_T> array, _T** dest, size_t* count)
+IPCAStatus IPCA_CALL AllocateAndCopyTypeVectorToArrayOfType(
+ std::vector<_T> array,
+ _T** dest,
+ size_t* count)
{
_T* buffer;
size_t arraySize = array.size();
}
template <typename _T>
-IPCAStatus IPCAPropertyBagGetValueArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key, _T** value,
- size_t* valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key, _T** value,
+ size_t* valueCount)
{
if (propertyBagHandle == nullptr)
{
return AllocateAndCopyTypeVectorToArrayOfType(array, value, valueCount);
}
-IPCAStatus IPCAPropertyBagGetValueIntArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int** value,
- size_t* valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueIntArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int** value,
+ size_t* valueCount)
{
return IPCAPropertyBagGetValueArray(propertyBagHandle, key, value, valueCount);
}
-void IPCAPropertyBagFreeIntArray(int* valueArray)
+void IPCA_CALL IPCAPropertyBagFreeIntArray(int* valueArray)
{
OICFree((void*)valueArray);
}
-IPCAStatus IPCAPropertyBagGetValueDoubleArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double** value,
- size_t* valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueDoubleArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double** value,
+ size_t* valueCount)
{
return IPCAPropertyBagGetValueArray(propertyBagHandle, key, value, valueCount);
}
-void IPCAPropertyBagFreeDoubleArray(double* valueArray)
+void IPCA_CALL IPCAPropertyBagFreeDoubleArray(double* valueArray)
{
OICFree((void*)valueArray);
}
-IPCAStatus IPCAPropertyBagGetValueBoolArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- bool** value,
- size_t* valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueBoolArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ bool** value,
+ size_t* valueCount)
{
return IPCAPropertyBagGetValueArray(propertyBagHandle, key, value, valueCount);
}
-void IPCAPropertyBagFreeBoolArray(bool* valueArray)
+void IPCA_CALL IPCAPropertyBagFreeBoolArray(bool* valueArray)
{
OICFree((void*)valueArray);
}
-IPCAStatus IPCAPropertyBagGetValueStringArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- char*** value,
- size_t* valueCount)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueStringArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ char*** value,
+ size_t* valueCount)
{
if (propertyBagHandle == nullptr)
{
return AllocateAndCopyStringVectorToArrayOfCharPointers(array, value, valueCount);
}
-void IPCAPropertyBagFreeStringArray(char** valueArray, size_t valueCount)
+void IPCA_CALL IPCAPropertyBagFreeStringArray(char** valueArray, size_t valueCount)
{
FreeArrayOfCharPointers(valueArray, valueCount);
}
-IPCAStatus IPCAPropertyBagGetValuePropertyBagArray(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- IPCAPropertyBagHandle** value,
- size_t* count)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValuePropertyBagArray(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ IPCAPropertyBagHandle** value,
+ size_t* count)
{
if (propertyBagHandle == nullptr)
{
return IPCA_OK;
}
-void IPCAPropertyBagFreePropertyBagArray(IPCAPropertyBagHandle* valueArray, size_t valueCount)
+void IPCA_CALL IPCAPropertyBagFreePropertyBagArray(
+ IPCAPropertyBagHandle* valueArray,
+ size_t valueCount)
{
for (size_t i = 0; i < valueCount; i++)
{
OICFree(valueArray);
}
-IPCAStatus IPCAPropertyBagGetValueInt(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- int* value)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueInt(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ int* value)
{
if (propertyBagHandle == nullptr)
{
return IPCA_OK;
}
-IPCAStatus IPCAPropertyBagGetValueDouble(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- double* value)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueDouble(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ double* value)
{
if (propertyBagHandle == nullptr)
{
return IPCA_OK;
}
-IPCAStatus IPCAPropertyBagGetValueBool(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- bool* value)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueBool(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ bool* value)
{
if (propertyBagHandle == nullptr)
{
return IPCA_OK;
}
-IPCAStatus IPCAPropertyBagGetValueString(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- char** buffer)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValueString(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ char** buffer)
{
if (propertyBagHandle == nullptr)
{
return AllocateAndCopyStringToFlatBuffer(stringValue, buffer);
}
-void IPCAPropertyBagFreeString(char* buffer)
+void IPCA_CALL IPCAPropertyBagFreeString(char* buffer)
{
OICFree(static_cast<void*>(buffer));
}
-IPCAStatus IPCAPropertyBagGetValuePropertyBag(IPCAPropertyBagHandle propertyBagHandle,
- const char* key,
- IPCAPropertyBagHandle* value)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetValuePropertyBag(
+ IPCAPropertyBagHandle propertyBagHandle,
+ const char* key,
+ IPCAPropertyBagHandle* value)
{
if (propertyBagHandle == nullptr)
{
return IPCA_OK;
}
-IPCAStatus IPCAPropertyBagGetResourcePath(IPCAPropertyBagHandle propertyBagHandle,
- char** resourcePath)
+IPCAStatus IPCA_CALL IPCAPropertyBagGetResourcePath(
+ IPCAPropertyBagHandle propertyBagHandle,
+ char** resourcePath)
{
if (propertyBagHandle == nullptr)
{
resourcePath);
}
-IPCAValueType AttributeTypeToIPCAValueType(AttributeType type)
+IPCAValueType IPCA_CALL AttributeTypeToIPCAValueType(AttributeType type)
{
IPCAValueType ipcaValueType;
return ipcaValueType;
}
-IPCAStatus IPCAPropertyBagGetAllKeyValuePairs(IPCAPropertyBagHandle propertyBagHandle,
+IPCAStatus IPCA_CALL IPCAPropertyBagGetAllKeyValuePairs(
+ IPCAPropertyBagHandle propertyBagHandle,
char*** keys,
IPCAValueType** valueTypes,
size_t* count)
return status;
}
-void IPCAPropertyBagFreeIPCAValueTypeArray(IPCAValueType* valueArray)
+void IPCA_CALL IPCAPropertyBagFreeIPCAValueTypeArray(IPCAValueType* valueArray)
{
OICFree((void*)valueArray);
}
-void IPCAPropertyBagDebugDump(IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL IPCAPropertyBagDebugDump(IPCAPropertyBagHandle propertyBagHandle)
{
OC::OCRepresentation* rep = (reinterpret_cast<OC::OCRepresentation*>(propertyBagHandle));
PrintOCRep(*rep);
return status;
}
-void C_GetPropertiesCb(IPCAStatus result, void* context, IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL C_GetPropertiesCb(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
IPCAElevatorClient* ipcaElevatorClient = (IPCAElevatorClient*)context;
ipcaElevatorClient->GetPropertiesCallback(result, context, propertyBagHandle);
return m_getPropertiesCallbackCalled;
}
-void C_SetPropertiesCb(IPCAStatus result, void* context, IPCAPropertyBagHandle propertyBagHandle)
+void IPCA_CALL C_SetPropertiesCb(
+ IPCAStatus result,
+ void* context,
+ IPCAPropertyBagHandle propertyBagHandle)
{
IPCAElevatorClient* ipcaTest = (IPCAElevatorClient*)context;
ipcaTest->SetPropertiesCallback(result, context, propertyBagHandle);
return m_setPropertiesCallbackCalled;
}
-void C_CreateResourceCb(IPCAStatus result,
+void IPCA_CALL C_CreateResourceCb(
+ IPCAStatus result,
void* context,
const char* newResourcePath,
IPCAPropertyBagHandle propertyBagHandle)
ipcaTest->CreateResourceCallback(result, newResourcePath, propertyBagHandle);
}
-bool IPCAElevatorClient::CreateElevatorResource(std::string resourcePath,
- IPCAPropertyBagHandle propertyBagHandle)
+bool IPCAElevatorClient::CreateElevatorResource(
+ std::string resourcePath,
+ IPCAPropertyBagHandle propertyBagHandle)
{
m_createResourceCallbackCalled = false;
return m_createResourceCallbackCalled;
}
-void C_DeleteResourceCb(IPCAStatus result, void* context)
+void IPCA_CALL C_DeleteResourceCb(IPCAStatus result, void* context)
{
IPCAElevatorClient* ipcaTest = (IPCAElevatorClient*)context;
ipcaTest->DeleteResourceCallback(result);
{
}
-void C_ResourceChangeNotificationCb(IPCAStatus result,
+void IPCA_CALL C_ResourceChangeNotificationCb(
+ IPCAStatus result,
void* context,
IPCAPropertyBagHandle propertyBagHandle)
{
}
}
-void C_DiscoverElevator1Cb(void* context,
- IPCADeviceStatus deviceStatus,
- const IPCADiscoveredDeviceInfo* discoveredDeviceInfo)
+void IPCA_CALL C_DiscoverElevator1Cb(
+ void* context,
+ IPCADeviceStatus deviceStatus,
+ const IPCADiscoveredDeviceInfo* discoveredDeviceInfo)
{
IPCAElevatorClient* ipcaTest = (IPCAElevatorClient*)context;
ipcaTest->DiscoverElevator1Callback(context, deviceStatus, discoveredDeviceInfo);
m_deleteResourceCompleteCV.notify_all();
}
-void IPCAElevatorClient::ResourceChangeNotificationCallback(IPCAStatus result,
- IPCAPropertyBagHandle propertyBagHandle)
+void IPCAElevatorClient::ResourceChangeNotificationCallback(
+ IPCAStatus result,
+ IPCAPropertyBagHandle propertyBagHandle)
{
EXPECT_EQ(IPCA_OK, result);
using namespace std::placeholders;
// Implemented in ipca.dll.
-void IPCASetUnitTestMode();
+void IPCA_CALL IPCASetUnitTestMode();
// IPCA test app info.
IPCAUuid IPCATestAppUuid = {
/**
* Mark a parameter as unused. Used to prevent unused variable compiler warnings.
*/
-#define OC_UNUSED(x) (void)(x)
+# define OC_UNUSED(x) (void)(x)
+
+/**
+ * Calling convention.
+ */
+#ifdef _WIN32
+/*
+ * Set to __stdcall for Windows, consistent with WIN32 APIs.
+ */
+# define OC_CALL __stdcall
+#else
+# define OC_CALL
+#endif
#endif