Hi,
We are using the Stonestreet One Bluetopia stack for the application development.
We are developing the custom BT profile based on the L2Cap layer. In which we are facing the problem while sending the data to other BT device.
We are using the following API’s for this L2cap layer based communication. In write call we are getting (-38) error and on other end (BT device 2) callback function not getting called.
So if you have any sample application that uses these L2cap layer API’s, please provide us.
Following is the code snippet in which are getting the write failed. Only important lines are shown below.
BT device 1:
1) After initializing the Bluetooth stack, following API is called.
ret_val=L2CA_Connect_Request(BluetoothStackID, BD_ADDR, L2CAP_PSM_MINIMUM_PSM,L2CA_Event_Callback, (unsigned long)0);
Display(("L2CAP_CID=%d\r\n",ret_val));
L2CAP_CID=ret_val;
2) In the event callback we check for the events.
switch(L2CA_Event_Data->L2CA_Event_Type)
case etConnect_Confirmation:
L2CA_Get_Current_Channel_Configuration(1,L2CAP_CID, ConfigParams);
L2CA_Config_Rq->InMTU=ConfigParams->OutMTU;
L2CA_Config_Rq->OutFlow=ConfigParams->InFlow;
L2CA_Config_Rq->OutFlushTO=ConfigParams->OutFlushTO;
ret_val=L2CA_Config_Request(1,L2CAP_CID,1000,L2CA_Config_Rq);
break;
case etConfig_Indication:
L2CA_Config_Rs=(L2CA_Config_Response_t *)L2CA_Event_Data->Event_Data.L2CA_Connect_Indication;
L2CA_Config_Rs->OutMTU=L2CA_Event_Data->Event_Data.L2CA_Config_Confirmation->InMTU;
L2CA_Config_Rs->InFlow=L2CA_Event_Data->Event_Data.L2CA_Config_Confirmation->OutFlow;
L2CA_Config_Rs->InFlushTO=L2CA_Event_Data->Event_Data.L2CA_Config_Confirmation->OutFlushTO;
ret_val=L2CA_Config_Response(1,L2CAP_CID,result,L2CA_Config_Rs);
break;
BT device 2:
1) Here after initializing the Bluetooth stack the channel registered for the callback.
ret_val=L2CA_Register_Fixed_Channel(3, L2CAP_CHANNEL_IDENTIFIER_CONNECTIONLESS_CHANNEL+1,NULL,L2CA_Event_Callback,0);
Display(("REG_Fixed_val=%d\r\n",ret_val));
// Tried by registering PSM
//ret_val=L2CA_Register_PSM(1,L2CAP_PSM_MINIMUM_PSM,L2CA_Event_Callback, 3);
//Display(("L2CA_Register_PSM_ret_val=%d\r\n"));
2) L2CA_Event_Callback is same as mentioned in the BT device 1 point 2.
If you have any sample applications which uses the API’s of L2cap and HCI layer of Blutopia stack. Which gives the idea of sequence of API’s to be called.
Thanks & regards,
Ravi