// ------------------------------------------------------------------------------------------------- static void GoOnline ( void ) { if(RequestRef) { LE_ERROR("A connection request already exist."); return; } RequestRef = le_data_Request(); LE_INFO("Requesting the default data connection: %p.", RequestRef); }
/* Asynchronous connectionRequest Lua API. * Final result will be received by ConnectionStateHandler. * * @returns on success: a Lua userdata containing the Request id * to be given back to le_data_Release. * @returns on error: nil+error_string */ static int l_connectionRequest(lua_State *L) { le_data_RequestObjRef_t ref = le_data_Request(); if ( ref != NULL){ nmctx* nmud = lua_newuserdata(L, sizeof(*nmud)); nmud->data_ref = ref; luaL_getmetatable(L, USERDATA); lua_setmetatable(L, -2); return 1; } else{ lua_pushnil(L); lua_pushstring(L, "le_data_Request failed (NULL returned)"); return 2; } }
static int mqttClient_connectData(mqttClient_t* clientData) { int rc = LE_OK; if (clientData->requestRef) { LE_ERROR("data connection request already exists"); rc = LE_BAD_PARAMETER; goto cleanup; } clientData->requestRef = le_data_Request(); LE_INFO("requesting data connection(%p)", clientData->requestRef); cleanup: return rc; }