Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teodb_ex_cpp.cpp File Reference
#include <cstring>
#include <condition_variable>
#include "teonet.hpp"

Macros

#define TDB_VERSION   "0.0.2"
 
#define APPNAME   _ANSI_MAGENTA "teodb_ex" _ANSI_NONE
 
#define TEODB_PEER   teo.getKe()->teo_cfg.app_argv[1]
 
#define TEODB_EX_KEY   "teo_db_ex"
 
#define TEST_KEY   "test"
 
#define TEST_VALUE   "{ \"name\": \"1\" }"
 

Functions

void event_cb (teo::Teonet &teo, teo::teoEvents event, void *data, size_t data_len, void *user_data)
 Callback Queue callback (the same as callback queue event). More...
 
int main (int argc, char **argv)
 Main Teonet Database example function. More...
 

Macro Definition Documentation

#define APPNAME   _ANSI_MAGENTA "teodb_ex" _ANSI_NONE
#define TDB_VERSION   "0.0.2"

Referenced by main().

#define TEODB_EX_KEY   "teo_db_ex"

Referenced by event_cb().

#define TEODB_PEER   teo.getKe()->teo_cfg.app_argv[1]

Referenced by event_cb().

#define TEST_KEY   "test"

Referenced by event_cb().

#define TEST_VALUE   "{ \"name\": \"1\" }"

Referenced by event_cb().

Function Documentation

void event_cb ( teo::Teonet teo,
teo::teoEvents  event,
void *  data,
size_t  data_len,
void *  user_data 
)

Callback Queue callback (the same as callback queue event).

This function calls at timeout or after ksnCQueExec calls

Parameters
idCalls ID
typeType: 0 - timeout callback; 1 - successful callback
dataUser data Teonet Events callback
kePointer to ksnetEvMgrClass
eventTeonet Event (ksnetEvMgrEvents)
dataEvents data
data_lenData length
user_dataSome user data (may be set in ksnetEvMgrInitPort())

References CMD_D_GET, CMD_D_LIST, CMD_D_SET, EV_K_CONNECTED, teo::Teonet::getPacket(), NUM_RECORDS_TO_SHOW, rd, TEODB_EX_KEY, TEODB_PEER, TEST_KEY, and TEST_VALUE.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Main Teonet Database example function.

Parameters
argcNumber of arguments
argvArguments array
Returns

References APP_PARAM, event_cb(), READ_CONFIGURATION, READ_OPTIONS, TDB_VERSION, and VERSION.