mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.
Dependents: MbedSmartRestMain MbedSmartRestMain
Diff: SmartRest.cpp
- Revision:
- 2:45a6e44a4fb4
- Parent:
- 1:9a11a331e340
- Child:
- 4:059b8b90e0d9
--- a/SmartRest.cpp Mon Jul 07 16:14:51 2014 +0200 +++ b/SmartRest.cpp Mon Jul 07 17:08:02 2014 +0200 @@ -30,13 +30,25 @@ #include <stdlib.h> #include <string.h> -SmartRest::SmartRest(AbstractClient& client, const char *identifier) : _client(client), _identifier(identifier) +SmartRest::SmartRest(AbstractClient& client, const char *identifier) : + _client(client), + _identifier(identifier) { _source = NULL; _mogid[0] = 0; } -int8_t SmartRest::send(const DataGenerator& generator, const char *overrideIdentifier) +uint8_t SmartRest::setAuthorization(const char *username, const char *password) +{ + uint8_t res; + + res = _client.setAuthorization(username, password); + if (res != CLIENT_OK) + return SMARTREST_INTERNAL_ERROR; + return SMARTREST_SUCCESS; +} + +uint8_t SmartRest::send(const DataGenerator& generator, const char *overrideIdentifier) { uint8_t res; @@ -48,7 +60,7 @@ return awaitResponse(); } -int8_t SmartRest::receive(ParsedRecord& record) +uint8_t SmartRest::receive(ParsedRecord& record) { uint8_t res; @@ -68,7 +80,7 @@ return SMARTREST_INTERNAL_ERROR; } -int8_t SmartRest::bootstrap(DataGenerator& generator) +uint8_t SmartRest::bootstrap(DataGenerator& generator) { ParsedRecord record; int8_t ret;