I give to the community the result of my last month's private work:
https://docs.google.com/file/d/0B9hKAVK ... gtaTQ/edit
WNETATMO.DLL gives to C/C++ programmers the ability to easily retrieve Netatmo devices parameters and measurements.
It actually implements a C interface that mimics the standard Netatmo API, i.e.:
Code: Select all
AUTHENTICATION -> WNETATMO_Authenticate(PAUTH_PRM pParams, PAUTH_RES *ppRes) REFRESH_TOKEN -> WNETATMO_RefreshToken(PREFTOK_PRM pParams, PAUTH_RES *ppRes) GETUSER -> WNETATMO_GetUser(PGU_PRM pParams, PGU_RES *ppRes) DEVICELIST -> WNETATMO_DeviceList(PDL_PRM pParams, PDL_RES *ppRes) GETMEASURE -> WNETATMO_GetMeasure(PGM_PRM pParams, PGM_RES *ppRes)
Code: Select all
WNETATMO_Free(LPVOID pItem) WNETATMO_Clean()
The source code of the DLL is given in DLL\WNETATMO.C.
The WNETATMO DLL hides the Internet communication aspects to the user application, as well as it hides the JSON parsing and data retrieval issues.
The DLL is written in pure C and has quite a low footprint.
Internet communication uses Microsoft standard Wininet library.
JSON parser code comes from the json-parser project (https://github.com/udp/json-parser).
Global interface philosophy is that each communicating function accepts two parameters:
- 1. A 'request' pointer to a structure holding the actual parameters.
Such parameters are designed to feed the underlaying POST or GET request to api.netatmo.net and are often very close of what has been defined for the official Netatmo API.
2. A 'result' pointer to a pointer to a structure that will hold the results after the Web Service exchange.
This structure is dynamically allocated by WNETATMO and should eventually be freed when not needed anymore by the application, using either NETATMO_Free or NETATMO_Clean.
A test/sample application is available in TEST\TestWNA. It calls various WNETATMO functions and prints the results in a command-prompt window.
User credentials should be placed in a NETATMO.INI file placed in the same directory as the executable, or in the parent directory. The NETATMO.INI file layout has been borrowed to Patouille.
Let me know if you are interested by this DLL, if you plan to use it, if you use it, if you find bugs, if you miss some functionality, etc.