コード例 #1
0
void eliza(void){

    uint8_t i, dlci = btRfcommReserveDlci(RFCOMM_DLCI_NEED_EVEN);
    int f;

    if(!dlci) dbgPrintf("ELIZA: failed to allocate DLCI\n");
    else{

        //change descriptor to be valid...
        for(i = 0, f = -1; i < sizeof(sdpDescrEliza); i++){

            if(sdpDescrEliza[i] == MAGIX){
                if(f == -1) f = i;
                else break;
            }
        }

        if(i != sizeof(sdpDescrEliza) || f == -1){

            dbgPrintf("ELIZA: failed to find a single marker in descriptor\n");
            btRfcommReleaseDlci(dlci);
            return;
        }

        sdpDescrEliza[f] = dlci >> 1;

        btRfcommRegisterPort(dlci, elzPortOpen, elzPortClose, elzPortRx);
        btSdpServiceDescriptorAdd(sdpDescrEliza, sizeof(sdpDescrEliza));
    }
}
コード例 #2
0
ファイル: ADK.c プロジェクト: CyrilleSavy/BluetoothDevMob
void btRfcommReleaseDlci_ADK(uint8_t dlci){

    btRfcommReleaseDlci(dlci);
}