コード例 #1
0
 void FnCallback(uint BluetoothStackID,
                 ref Structs.HCI_Event_Data_t hciEventData, uint CallbackParameter)
 {
     try {
         FnCallback2(BluetoothStackID,
                     ref hciEventData, CallbackParameter);
     } catch (Exception ex) {
         Utils.MiscUtils.Trace_WriteLine("Exception from our HCI_ _Event_Callback!!!: " + ex);
     }
 }
コード例 #2
0
 void FnCallback2(uint BluetoothStackID,
                  ref Structs.HCI_Event_Data_t hciEventData, uint CallbackParameter)
 {
     Debug.WriteLine("HCI Callback: " + hciEventData.Event_Data_Type);
     if (hciEventData.Event_Data_Type == StackConsts.HCI_Event_Type_t.etConnection_Complete_Event)
     {
         var data = (Structs.HCI_Connection_Complete_Event_Data_t)Marshal.PtrToStructure(
             hciEventData.pData, typeof(Structs.HCI_Connection_Complete_Event_Data_t));
         if (data.Link_Type == StackConsts.HCI_LINK_TYPE.ACL_CONNECTION)
         {
             _hConn = data.Connection_Handle;
         }
     }
     else if (hciEventData.Event_Data_Type == StackConsts.HCI_Event_Type_t.etVendor_Specific_Debug_Event)
     {
         var data  = new byte[hciEventData.Event_Data_Size];
         var pData = hciEventData.pData;
         Marshal.Copy(pData, data, 0, data.Length);
         Debug.WriteLine("vendor event data: " + BitConverter.ToString(data, 0));
     }
 }