Http adapted library to connect the DISCO_F746NG board to thethings.iO
Dependents: thethingsiO-DISCO_F746NG-http
Diff: ThethingsiO_DISCO_F746NG.h
- Revision:
- 0:2f025da7eef3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ThethingsiO_DISCO_F746NG.h Tue Sep 06 08:44:29 2016 +0000 @@ -0,0 +1,51 @@ +#ifndef __ThethingsiO_DISCO_F746NG_H +#define __ThethingsiO_DISCO_F746NG_H + +#ifdef TARGET_DISCO_F746NG + + +#include <iostream> +#include <string> +#include <sstream> +#include "mbed.h" +#include "EthernetInterface.h" +#include "NetworkAPI/buffer.hpp" +#include "NetworkAPI/ip/address.hpp" +#include "NetworkAPI/tcp/socket.hpp" + + +class ThethingsiO_DISCO_F746NG +{ +public: + + ThethingsiO_DISCO_F746NG(); + + ThethingsiO_DISCO_F746NG(string token); + + ~ThethingsiO_DISCO_F746NG(); + + string thingReadAll(int limit); + + string thingRead(string resource, int limit); + + int thingWrite(string resource, string value); + + string thingActivate(string activationCode); + + string getToken(); + + void setToken(string token); + +private: + + string thingToken; + EthernetInterface interface; + network::tcp::Socket socket; + network::Buffer buffer; +}; + +#else +#error "This class must be used with DISCO_F746NG board only." +#endif // TARGET_DISCO_F746NG + +#endif