A modelling and serializer library for Microsoft Azure IoTHub client applications
Dependents: sht15_remote_monitoring f767zi_mqtt remote_monitoring simplesample_amqp ... more
This library implements a serializer library to be used in projects involving Microsoft Azure IoT Hub connectivity. The code is replicated from https://github.com/Azure/azure-iot-sdks
Diff: commanddecoder.h
- Revision:
- 0:1f9b2707ec7d
- Child:
- 10:c2aee3965a83
diff -r 000000000000 -r 1f9b2707ec7d commanddecoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commanddecoder.h Tue Sep 15 21:57:26 2015 -0700 @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#ifndef COMMAND_DECODER_H +#define COMMAND_DECODER_H + +#include "multitree.h" +#include "schema.h" +#include "agenttypesystem.h" +#include "macro_utils.h" + +#define COMMANDDECODER_RESULT_VALUES \ + COMMANDDECODER_OK, \ + COMMANDDECODER_ERROR, \ + COMMANDDECODER_INVALID_ARG + +DEFINE_ENUM(COMMANDDECODER_RESULT, COMMANDDECODER_RESULT_VALUES) + +#define EXECUTE_COMMAND_RESULT_VALUES \ +EXECUTE_COMMAND_SUCCESS, /*when the final recipient of the command indicates a successful execution*/ \ +EXECUTE_COMMAND_FAILED, /*when the final recipient of the command indicates a failure*/ \ +EXECUTE_COMMAND_ERROR /*when a transient error either in the final recipient or until the final recipient*/ + +DEFINE_ENUM(EXECUTE_COMMAND_RESULT, EXECUTE_COMMAND_RESULT_VALUES) + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Codes_SRS_COMMAND_DECODER_99_001:[ The CommandDecoder module shall expose the following API:] */ + +typedef void* COMMAND_DECODER_HANDLE; +typedef EXECUTE_COMMAND_RESULT(*ACTION_CALLBACK_FUNC)(void* actionCallbackContext, const char* relativeActionPath, const char* actionName, size_t argCount, const AGENT_DATA_TYPE* args); + +extern COMMAND_DECODER_HANDLE CommandDecoder_Create(SCHEMA_MODEL_TYPE_HANDLE modelHandle, ACTION_CALLBACK_FUNC actionCallback, void* actionCallbackContext); +extern EXECUTE_COMMAND_RESULT CommandDecoder_ExecuteCommand(COMMAND_DECODER_HANDLE handle, const char* command); +extern void CommandDecoder_Destroy(COMMAND_DECODER_HANDLE commandDecoderHandle); + +#ifdef __cplusplus +} +#endif + +#endif /* COMMAND_DECODER_H */