コード例 #1
0
ファイル: demo.c プロジェクト: mbaglin/legato-af
// -------------------------------------------------------------------------------------------------
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);
}
コード例 #2
0
/* 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;
    }
}
コード例 #3
0
ファイル: mqttClient.c プロジェクト: CoRfr/mangOH-MqttClient
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;
}