Exemple #1
0
static void send_packet(void){
    rfcomm_send(rfcomm_cid, (uint8_t*) test_data, test_data_len);

    test_track_sent(test_data_len);
    if (data_to_send <= test_data_len){
        state = DONE;
        printf("SPP Streamer: enough data send, closing channel\n");
        rfcomm_disconnect(rfcomm_cid);
        rfcomm_cid = 0;
        return;
    }
    data_to_send -= test_data_len;
    rfcomm_request_can_send_now_event(rfcomm_cid);
}
Exemple #2
0
 /* LISTING_START(streamer): Streaming code */
static void streamer(void){
    // check if we can send
    if (!le_notification_enabled) return;
    if (!att_server_can_send()) return;

    // create test data
    int i;
    counter++;
    if (counter > 'Z') counter = 'A';
    for (i=0;i<sizeof(test_data);i++){
        test_data[i] = counter;
    }

    // send
    att_server_notify(ATT_CHARACTERISTIC_0000FF11_0000_1000_8000_00805F9B34FB_01_VALUE_HANDLE, (uint8_t*) test_data, test_data_len);

    // track
    test_track_sent(test_data_len);
}