Azure IoT / serializer

Dependents:   sht15_remote_monitoring f767zi_mqtt remote_monitoring simplesample_amqp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers commanddecoder.h Source File

commanddecoder.h

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #ifndef COMMAND_DECODER_H
00005 #define COMMAND_DECODER_H
00006 
00007 #include "multitree.h"
00008 #include "schema.h"
00009 #include "agenttypesystem.h"
00010 #include "azure_c_shared_utility/macro_utils.h"
00011 #include "methodreturn.h"
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #else
00016 #include <stdbool.h>
00017 #endif
00018 
00019 #define COMMANDDECODER_RESULT_VALUES \
00020     COMMANDDECODER_OK, \
00021     COMMANDDECODER_ERROR, \
00022     COMMANDDECODER_INVALID_ARG
00023 
00024 DEFINE_ENUM(COMMANDDECODER_RESULT, COMMANDDECODER_RESULT_VALUES)
00025 
00026 #define EXECUTE_COMMAND_RESULT_VALUES \
00027 EXECUTE_COMMAND_SUCCESS, /*when the final recipient of the command indicates a successful execution*/ \
00028 EXECUTE_COMMAND_FAILED, /*when the final recipient of the command indicates a failure*/ \
00029 EXECUTE_COMMAND_ERROR /*when a transient error either in the final recipient or until the final recipient*/
00030 
00031 DEFINE_ENUM(EXECUTE_COMMAND_RESULT, EXECUTE_COMMAND_RESULT_VALUES)
00032 
00033 
00034 
00035 
00036 /* Codes_SRS_COMMAND_DECODER_99_001:[ The CommandDecoder module shall expose the following API:] */
00037 
00038 typedef struct COMMAND_DECODER_HANDLE_DATA_TAG* COMMAND_DECODER_HANDLE;
00039 typedef EXECUTE_COMMAND_RESULT(*ACTION_CALLBACK_FUNC)(void* actionCallbackContext, const char* relativeActionPath, const char* actionName, size_t argCount, const AGENT_DATA_TYPE* args);
00040 typedef METHODRETURN_HANDLE(*METHOD_CALLBACK_FUNC)(void* methodCallbackContext, const char* relativeMethodPath, const char* methodName, size_t argCount, const AGENT_DATA_TYPE* args);
00041 
00042 #include "azure_c_shared_utility/umock_c_prod.h"
00043 
00044 MOCKABLE_FUNCTION(,COMMAND_DECODER_HANDLE, CommandDecoder_Create, SCHEMA_MODEL_TYPE_HANDLE, modelHandle, ACTION_CALLBACK_FUNC, actionCallback, void*, actionCallbackContext, METHOD_CALLBACK_FUNC, methodCallback, void*, methodCallbackContext);
00045 MOCKABLE_FUNCTION(,EXECUTE_COMMAND_RESULT, CommandDecoder_ExecuteCommand, COMMAND_DECODER_HANDLE, handle, const char*, command);
00046 MOCKABLE_FUNCTION(,METHODRETURN_HANDLE, CommandDecoder_ExecuteMethod, COMMAND_DECODER_HANDLE, handle, const char*, fullMethodName, const char*, methodPayload);
00047 MOCKABLE_FUNCTION(,void, CommandDecoder_Destroy, COMMAND_DECODER_HANDLE, commandDecoderHandle);
00048 
00049 MOCKABLE_FUNCTION(, EXECUTE_COMMAND_RESULT, CommandDecoder_IngestDesiredProperties, void*, startAddress, COMMAND_DECODER_HANDLE, handle, const char*, jsonPayload, bool, parseDesiredNode);
00050 
00051 #ifdef __cplusplus
00052 }
00053 #endif
00054 
00055 #endif /* COMMAND_DECODER_H */