コード例 #1
0
ファイル: BluesoleilFactory.cs プロジェクト: zhubin-12/32feet
        internal void RegisterCallbacksOnce()
        {
            if (_inquiryResultIndFunc != null)
            {
                return;
            }
            BtSdkError ret;

            Structs.BtSdkCallbackStru val;
            //
            _inquiryResultIndFunc = _inquiryHandler.HandleInquiryResultInd;
            val = new Structs.BtSdkCallbackStru(_inquiryResultIndFunc);
            Debug.Assert(val._type == StackConsts.CallbackType.INQUIRY_RESULT_IND);
            ret = Api.Btsdk_RegisterCallback4ThirdParty(ref val);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_RegisterCallback4ThirdParty");
            //
            _inquiryCompleteIndFunc = HandleInquiryComplete;
            val = new Structs.BtSdkCallbackStru(_inquiryCompleteIndFunc);
            Debug.Assert(val._type == StackConsts.CallbackType.INQUIRY_COMPLETE_IND);
            ret = Api.Btsdk_RegisterCallback4ThirdParty(ref val);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_RegisterCallback4ThirdParty");
            //
            //----
            _pinReqIndFunc = _sec.HandlePinReqInd;
            val            = new Structs.BtSdkCallbackStru(_pinReqIndFunc);
            Debug.Assert(val._type == StackConsts.CallbackType.PIN_CODE_IND);
            ret = Api.Btsdk_RegisterCallback4ThirdParty(ref val);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_RegisterCallback4ThirdParty");
            //
            //----
            _connectionEventIndFunc = _records.HandleConnectionEventInd;
            val = new Structs.BtSdkCallbackStru(_connectionEventIndFunc);
            Debug.Assert(val._type == StackConsts.CallbackType.CONNECTION_EVENT_IND);
            ret = Api.Btsdk_RegisterCallback4ThirdParty(ref val);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_RegisterCallback4ThirdParty");
            //
            _statusCallback = HandleReceiveBluetoothStatusInfo;
            ret             = Api.Btsdk_RegisterGetStatusInfoCB4ThirdParty(ref _statusCallback);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_RegisterGetStatusInfoCB4ThirdParty");
            ret = Api.Btsdk_SetStatusInfoFlag(StackConsts.BTSDK_BLUETOOTH_STATUS_FLAG);
            BluesoleilUtils.CheckAndThrow(ret, "Btsdk_SetStatusInfoFlag");
        }
コード例 #2
0
ファイル: NativeMethods.cs プロジェクト: zhubin-12/32feet
 internal static extern BtSdkError Btsdk_RegisterCallback4ThirdParty(ref Structs.BtSdkCallbackStru call_back);
コード例 #3
0
 BtSdkError IBluesoleilApi.Btsdk_RegisterCallback4ThirdParty(ref Structs.BtSdkCallbackStru call_back)
 {
     return(NativeMethods.Btsdk_RegisterCallback4ThirdParty(ref call_back));
 }