1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #ifndef IOTDEVICE_H
|
---|
5 | #define IOTDEVICE_H
|
---|
6 |
|
---|
7 | #include <stdbool.h>
|
---|
8 | #include "azure_macro_utils/macro_utils.h"
|
---|
9 | #include "schema.h"
|
---|
10 | #include "datapublisher.h"
|
---|
11 | #include "commanddecoder.h"
|
---|
12 | #include "methodreturn.h"
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | #include <cstddef>
|
---|
16 | extern "C" {
|
---|
17 | #else
|
---|
18 | #include <stddef.h>
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | #define DEVICE_RESULT_VALUES \
|
---|
22 | DEVICE_OK, \
|
---|
23 | DEVICE_INVALID_ARG, \
|
---|
24 | DEVICE_DATA_PUBLISHER_FAILED, \
|
---|
25 | DEVICE_COMMAND_DECODER_FAILED, \
|
---|
26 | DEVICE_ERROR
|
---|
27 |
|
---|
28 | MU_DEFINE_ENUM_WITHOUT_INVALID(DEVICE_RESULT, DEVICE_RESULT_VALUES)
|
---|
29 |
|
---|
30 | #include "umock_c/umock_c_prod.h"
|
---|
31 |
|
---|
32 | typedef struct DEVICE_HANDLE_DATA_TAG* DEVICE_HANDLE;
|
---|
33 | typedef EXECUTE_COMMAND_RESULT (*pfDeviceActionCallback)(DEVICE_HANDLE deviceHandle, void* callbackUserContext, const char* relativeActionPath, const char* actionName, size_t argCount, const AGENT_DATA_TYPE* args);
|
---|
34 | typedef METHODRETURN_HANDLE (*pfDeviceMethodCallback)(DEVICE_HANDLE deviceHandle, void* callbackUserContext, const char* relativeMethodPath, const char* methodName, size_t argCount, const AGENT_DATA_TYPE* args);
|
---|
35 |
|
---|
36 | MOCKABLE_FUNCTION(,DEVICE_RESULT, Device_Create, SCHEMA_MODEL_TYPE_HANDLE, modelHandle, pfDeviceActionCallback, deviceActionCallback, void*, callbackUserContext, pfDeviceMethodCallback, methodCallback, void*, methodCallbackContext, bool, includePropertyPath, DEVICE_HANDLE*, deviceHandle);
|
---|
37 | MOCKABLE_FUNCTION(, void, Device_Destroy, DEVICE_HANDLE, deviceHandle);
|
---|
38 |
|
---|
39 | MOCKABLE_FUNCTION(,TRANSACTION_HANDLE, Device_StartTransaction, DEVICE_HANDLE, deviceHandle);
|
---|
40 | MOCKABLE_FUNCTION(,DEVICE_RESULT, Device_PublishTransacted, TRANSACTION_HANDLE, transactionHandle, const char*, propertyPath, const AGENT_DATA_TYPE*, data);
|
---|
41 | MOCKABLE_FUNCTION(,DEVICE_RESULT, Device_EndTransaction, TRANSACTION_HANDLE, transactionHandle, unsigned char**, destination, size_t*, destinationSize);
|
---|
42 | MOCKABLE_FUNCTION(,DEVICE_RESULT, Device_CancelTransaction, TRANSACTION_HANDLE, transactionHandle);
|
---|
43 |
|
---|
44 | MOCKABLE_FUNCTION(, REPORTED_PROPERTIES_TRANSACTION_HANDLE, Device_CreateTransaction_ReportedProperties, DEVICE_HANDLE, deviceHandle);
|
---|
45 | MOCKABLE_FUNCTION(, DEVICE_RESULT, Device_PublishTransacted_ReportedProperty, REPORTED_PROPERTIES_TRANSACTION_HANDLE, transactionHandle, const char*, reportedPropertyPath, const AGENT_DATA_TYPE*, data);
|
---|
46 | MOCKABLE_FUNCTION(, DEVICE_RESULT, Device_CommitTransaction_ReportedProperties, REPORTED_PROPERTIES_TRANSACTION_HANDLE, transactionHandle, unsigned char**, destination, size_t*, destinationSize);
|
---|
47 | MOCKABLE_FUNCTION(, void, Device_DestroyTransaction_ReportedProperties, REPORTED_PROPERTIES_TRANSACTION_HANDLE, transactionHandle);
|
---|
48 |
|
---|
49 | MOCKABLE_FUNCTION(, EXECUTE_COMMAND_RESULT, Device_ExecuteCommand, DEVICE_HANDLE, deviceHandle, const char*, command);
|
---|
50 | MOCKABLE_FUNCTION(, METHODRETURN_HANDLE, Device_ExecuteMethod, DEVICE_HANDLE, deviceHandle, const char*, methodName, const char*, methodPayload);
|
---|
51 |
|
---|
52 | MOCKABLE_FUNCTION(, DEVICE_RESULT, Device_IngestDesiredProperties, void*, startAddress, DEVICE_HANDLE, deviceHandle, const char*, jsonPayload, bool, parseDesiredNode);
|
---|
53 | #ifdef __cplusplus
|
---|
54 | }
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | #endif /* IOTDEVICE_H */
|
---|
58 |
|
---|