예제 #1
0
// read action comming from master
boolean LGATTSUart::onRead(LGATTReadRequest &data)
{
    APP_LOG("LGATTSUart::onRead _connected [%d]", _connected);
    if (_connected)
    {
        LGATTAttributeValue value = {0};
        const char *str = "[peripheral] tx";
        memcpy(value.value, str, strlen(str));
        value.len = strlen(str);

        APP_LOG("LGATTSUart::onRead onRead [%d][%s]", value.len, value.value);


        data.ackOK(value);

    }
    return true;
}
예제 #2
0
// read action comming from master
boolean LGATTSBomb::onRead(LGATTReadRequest &data)
{
    APP_LOG("LGATTSUart::onRead _connected [%d]", _connected);
    if (_connected)
    {
        if(data.attr_handle == _handle_control_bomb_char_description)
        {
            LGATTAttributeValue value = {0};
            const char *str = "Bomb Control";
            memcpy(value.value, str, strlen(str));
            value.len = strlen(str);
            
            APP_LOG("LGATTSUart::onRead onRead [%d][%s]", value.len, value.value);
            
            data.ackOK(value);
        }
        else
        {
            data.ackFail();
        }
    }
    return true;
}