|
Teonet library
0.4.7
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "embedded/jsmn/jsmn.h"#include "modules/teodb_com.h"#include "ev_mgr.h"Macros | |
| #define | TDB_VERSION "0.0.6" |
| #define | APPNAME _ANSI_MAGENTA "teodb" _ANSI_NONE |
| #define | DEFAULT_NAMESPACE "test" |
| #define | BINARY "BINARY" |
| #define | JSON "JSON" |
| #define | JSON_LEN 4 |
| #define | get_data_type() |
| Check data type and show message. More... | |
Typedefs | |
| typedef struct json_param | json_param |
| JSON request parameters structure. More... | |
Functions | |
| void | event_cb (ksnetEvMgrClass *ke, ksnetEvMgrEvents event, void *data, size_t data_len, void *user_data) |
| Teonet event handler. More... | |
| int | main (int argc, char **argv) |
| Main application function. More... | |
Teonet database based at PBL KEYFILE: – C key file, C-KeyFile An open source C key file implementation, see pblKf functions
Features:
The basic functions (commands) of the application:
whre:
API:
CMD_D_SET = 129, ///< #129 Set data request: { key, data, data_len, id } } CMD_D_GET, ///< #130 Get data request: { key, id } } CMD_D_LIST, ///< #131 List request: { key, id } } CMD_D_GET_ANSWER, ///< #132 Get data response: { key, data, data_len, id } } CMD_D_LIST_ANSWER, ///< #133 List response: [ { key, id }, ... ]
CMD_D_LIST_LENGTH, ///< #134 List length request: { key, id } } CMD_D_LIST_LENGTH_ANSWER, ///< #135 List response: { listLength, key, id }
CMD_D_LIST_RANGE, ///< #136 List length request: { id, key, from, to } } ///< bynary data structure: typedef struct teo_db_data_range { uint32_t from; ///< From index (begin from zero) uint32_t to; ///< To index (not include)) }; CMD_D_LIST_RANGE_ANSWER, ///< #137 List response: { listLength, key, ID }
Subscribe:
EV_D_SET - #26 send event when database updated
Created on August 20, 2015, 3:36 PM
| #define APPNAME _ANSI_MAGENTA "teodb" _ANSI_NONE |
Referenced by event_cb().
| #define BINARY "BINARY" |
| #define DEFAULT_NAMESPACE "test" |
Referenced by event_cb().
| #define get_data_type | ( | ) |
Check data type and show message.
Referenced by event_cb().
| #define JSON "JSON" |
| #define JSON_LEN 4 |
| #define TDB_VERSION "0.0.6" |
Referenced by main().
| typedef struct json_param json_param |
JSON request parameters structure.
key data
| void event_cb | ( | ksnetEvMgrClass * | ke, |
| ksnetEvMgrEvents | event, | ||
| void * | data, | ||
| size_t | data_len, | ||
| void * | user_data | ||
| ) |
Teonet event handler.
| ke | |
| event | |
| data | |
| data_len | |
| user_data |
References APPNAME, ksnCorePacketData::cmd, CMD_D_ERROR_ANSWER, CMD_D_GET, CMD_D_GET_ANSWER, CMD_D_LIST, CMD_D_LIST_ANSWER, CMD_D_LIST_LENGTH, CMD_D_LIST_LENGTH_ANSWER, CMD_D_LIST_RANGE, CMD_D_LIST_RANGE_ANSWER, CMD_D_SET, data, ksnCorePacketData::data, ksnCorePacketData::data_len, teo_db_data::data_length, DEBUG, DEFAULT_NAMESPACE, EV_D_SET, EV_K_RECEIVED, EV_K_STARTED, EV_K_STOPPED_BEFORE, free(), get_data_type, teo_db_data::id, ksnetEvMgrClass::kc, ksnCoreClass::kco, teo_db_data::key_data, teo_db_data::key_length, ksnetEvMgrClass::kf, ksn_printf, ksnet_formatMessage(), ksnet_sformatMessage(), ksnet_stringArrFree(), ksnTDBdelete(), ksnTDBdeleteStr(), ksnTDBget(), ksnTDBgetStr(), ksnTDBkeyList(), ksnTDBnamespaceSet(), ksnTDBset(), ksnTDBsetStr(), ksnCommandClass::ksscr, malloc(), memdup(), null_str, prepare_request_data(), and teoSScrSend().
Referenced by ksnetEvMgrInitPort(), main(), teoAsyncInit(), and teoLoggingClientInit().
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Main application function.
| argc | |
| argv |
References event_cb(), ksnetEvMgrInit(), ksnetEvMgrRun(), READ_ALL, TDB_VERSION, teoGetLibteonetVersion(), teoSetAppType(), and teoSetAppVersion().