Azure IoT / serializer

Dependents:   sht15_remote_monitoring f767zi_mqtt remote_monitoring simplesample_amqp ... more

commanddecoder.h

Committer:
AzureIoTClient
Date:
2015-10-22
Revision:
4:233dd7616d73
Parent:
0:1f9b2707ec7d
Child:
10:c2aee3965a83

File content as of revision 4:233dd7616d73:

// 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 */