Beispiel #1
0
CAResult_t CAInitLEGattServer()
{
    OIC_LOG(DEBUG, TAG, "IN");

    int ret =  bt_gatt_server_initialize();
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_server_initialize failed with ret[%s]",
                  CALEGetErrorMsg(ret));
        return CA_STATUS_FAILED;
    }

    bt_gatt_server_h server;

    ret = bt_gatt_server_create(&server);
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_server_create failed with ret[%s]",
                  CALEGetErrorMsg(ret));
        return CA_STATUS_FAILED;
    }

    if (NULL != g_gattServer)
    {
        OICFree(g_gattServer);
        g_gattServer = NULL;
    }
    g_gattServer = server;

    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}
Beispiel #2
0
CAResult_t CAInitLEGattServer()
{
    OIC_LOG(DEBUG, TAG, "IN");

    int ret =  bt_gatt_server_initialize();
    if (0 != ret)
    {
        OIC_LOG_V(ERROR, TAG, "bt_gatt_server_initialize failed with ret[%s]",
                  CALEGetErrorMsg(ret));
        return CA_STATUS_FAILED;
    }

    if (!g_gattServer)
    {
        OIC_LOG(DEBUG, TAG, "g_gattServer is NULL. create gatt server..");
        ret = bt_gatt_server_create(&g_gattServer);
        if (0 != ret)
        {
            OIC_LOG_V(ERROR, TAG, "bt_gatt_server_create failed with ret[%s]",
                      CALEGetErrorMsg(ret));
            return CA_STATUS_FAILED;
        }
    }

    OIC_LOG(DEBUG, TAG, "OUT");
    return CA_STATUS_OK;
}