A simple CIoT message protocol, used in the Water Meter Demos.

This library provides a small messaging protocol for a CIoT device, intended for use with the Water Meter Demo. As well as building for the C027 target, files are included for building a C DLL and, from that, a C Sharp DLL which can be linked into the PC-end of the Water Meter Demo (see the .ZIP file stored in the Wiki of the Water Meter Demo project) to provide end-to-end messaging with complete transparency. Since these PC files cannot be built inside mbed the source files are post-fixed with a ".txt" extension to keep them out of the way.

If a water pump is to be switched on/off as part of the demo, an interface circuit is required, which is described on the Wiki of the WaterMeterSupport library.

IotMeterDllWrapper.hpp.txt

Committer:
RobMeades
Date:
2015-05-22
Revision:
0:5c46cb3be899

File content as of revision 0:5c46cb3be899:

/* DLL wrapper for C027N/water-meter message handling functions
 * for MWC demo 2015
 * 
 * Copyright (C) u-blox Melbourn Ltd
 * u-blox Melbourn Ltd, Melbourn, UK
 * 
 * All rights reserved.
 *
 * This source file is the sole property of u-blox Melbourn Ltd.
 * Reproduction or utilization of this source in whole or part is
 * forbidden without the written consent of u-blox Melbourn Ltd.
 */

#ifndef IOT_METER_DLL_WRAPPER_HPP
#define IOT_METER_DLL_WRAPPER_HPP

/**
 * @file iot_meter_dll_wrapper.h
 * This file defines the encapsulation necessary to
 * call the CPP Message Handling functions from C#.
 */
 
#ifdef __cplusplus
extern "C" {
#endif

    #define DLL __declspec(dllexport)

    DLL uint32_t __cdecl maxDatagramSizeRaw (void);
    DLL uint32_t __cdecl gpioWaterPump (void);

    DLL uint32_t __cdecl encodeRebootReqDlMsg (char * pBuffer,
                                               bool devModeOnNotOff);
    DLL uint32_t __cdecl encodeSerialNumberGetReqDlMsg (char * pBuffer);
    DLL uint32_t __cdecl encodeReadingIntervalSetReqDlMsg (char * pBuffer,
                                                            uint32_t readingIntervalSeconds);
    DLL uint32_t __cdecl encodeReadingIntervalGetReqDlMsg (char * pBuffer);
    DLL uint32_t __cdecl encodeGpioSetReqDlMsg (char * pBuffer,
                                                uint8_t gpio,
                                                bool inputNotOutput,
                                                bool onNotOff);
    DLL uint32_t __cdecl encodeGpioGetReqDlMsg (char * pBuffer,
                                                 uint32_t gpio);
    DLL uint32_t __cdecl encodeLedSetReqDlMsg (char * pBuffer,
                                                bool onNotOff);
    DLL uint32_t __cdecl encodeLedGetReqDlMsg (char * pBuffer);
    DLL uint32_t __cdecl encodeFlashSetReqDlMsg (char * pBuffer,
                                                  bool onNotOff);
    DLL uint32_t __cdecl encodeFlashGetReqDlMsg (char * pBuffer);
    DLL void __cdecl unpackGpioState (uint32_t value,
                                      uint32_t *pGpio,
                                      bool * pInputNotOutput,
                                      bool * pOnNotOff);
    DLL uint32_t __cdecl decodeUlMsg (const char ** ppInBuffer,
                                      uint32_t sizeInBuffer,
                                      uint32_t * pContents);

    DLL void  initDll (void (*guiPrintToConsole) (const char *)); 

#ifdef __cplusplus
}
#endif

#endif

// End Of File