Example #1
0
 BluetopiaError IBluetopiaApi.GAP_Perform_Inquiry(uint BluetoothStackID,
                                                  StackConsts.GAP_Inquiry_Type GAP_Inquiry_Type,
                                                  uint MinimumPeriodLength, uint MaximumPeriodLength,
                                                  uint InquiryLength, uint MaximumResponses,
                                                  NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(BluetopiaError.UNSUPPORTED_PLATFORM_ERROR);
 }
Example #2
0
 BluetopiaError IBluetopiaApi.GAP_Initiate_Bonding(uint BluetoothStackID, Int64 BD_ADDR,
                                                   StackConsts.GAP_Bonding_Type GAP_Bonding_Type,
                                                   NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(NativeMethods.GAP_Initiate_Bonding(BluetoothStackID, BD_ADDR,
                                               GAP_Bonding_Type,
                                               GAP_Event_Callback, CallbackParameter));
 }
Example #3
0
 //
 BluetopiaError IBluetopiaApi.GAP_Perform_Inquiry(uint BluetoothStackID, StackConsts.GAP_Inquiry_Type GAP_Inquiry_Type,
                                                  uint MinimumPeriodLength, uint MaximumPeriodLength,
                                                  uint InquiryLength, uint MaximumResponses,
                                                  NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(NativeMethods.GAP_Perform_Inquiry(BluetoothStackID, GAP_Inquiry_Type,
                                              MinimumPeriodLength, MaximumPeriodLength,
                                              InquiryLength, MaximumResponses,
                                              GAP_Event_Callback, CallbackParameter));
 }
Example #4
0
 internal void CreateMockedSecurityApi()
 {
     _secMock = this.Mockery.NewMock <IBluetopiaSecurity>();
     Expect.Once.On(_secMock).Method("InitStack")
     .WithNoArguments()
     .Will(
         new MyDelegateAction(delegate {
         this.MockedApi.GAP_Set_Pairability_Mode(this.StackId, StackConsts.GAP_Pairability_Mode.PairableMode);
         NativeMethods.GAP_Event_Callback foo = null;
         this.MockedApi.GAP_Register_Remote_Authentication(this.StackId, foo, (uint)0);
     })
         );
     var tmp = this.GetFactory(_secMock);
 }
Example #5
0
 BluetopiaError IBluetopiaApi.GAP_Register_Remote_Authentication(uint BluetoothStackID,
                                                                 NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(NativeMethods.GAP_Register_Remote_Authentication(BluetoothStackID,
                                                             GAP_Event_Callback, CallbackParameter));
 }
Example #6
0
 BluetopiaError IBluetopiaApi.GAP_Authenticate_Remote_Device(uint BluetoothStackID, Int64 BD_ADDR,
                                                             NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(NativeMethods.GAP_Authenticate_Remote_Device(BluetoothStackID, BD_ADDR,
                                                         GAP_Event_Callback, CallbackParameter));
 }
Example #7
0
        internal BluetopiaFactory(IBluetopiaApi api, IBluetopiaSecurity optionalSecurityInstance)
        {
            if (api == null)
            {
                throw new ArgumentNullException("api");
            }
            _api = api;
            //
            _inquiryHandler       = new BluetopiaInquiry(this);
            _inquiryEventCallback = _inquiryHandler.HandleInquiryEvent;
            _HandleNameLookup     = HandleNameLookup;
            //
            //int handle = _api.BSC_Initialize((byte[])InitData.Clone(), 0);
            Utils.MiscUtils.Trace_WriteLine(
                "Calling BSC_Initialize with:" + InitData2.ToString());
            int handle = _api.BSC_Initialize(ref InitData2, 0);
            //TEST--CheckStructBytes(ref InitData2, (byte[])InitData.Clone());
            var ret = (BluetopiaError)handle;

            if (!BluetopiaUtils.IsSuccessZeroIsIllegal(ret))
            {
                KillBtExplorerExe();  // Since one app at a time!
                // _Quickly_ try to init, as BTExplorer.exe restarts automatically!
                handle = _api.BSC_Initialize(ref InitData2, 0);
                ret    = (BluetopiaError)handle;
            }
            if (!BluetopiaUtils.IsSuccessZeroIsIllegal(ret))
            {
                Utils.MiscUtils.Trace_WriteLine("Stonestreet One Bluetopia failed to init: "
                                                + BluetopiaUtils.ErrorToString(ret));
            }
            BluetopiaUtils.CheckAndThrowZeroIsIllegal(ret, "BSC_Initialize");
            _stackId = checked ((uint)handle);
            //
            if (optionalSecurityInstance != null)
            {
                _sec = optionalSecurityInstance;
            }
            else
            {
                _sec = new BluetopiaSecurity(this);
            }
            _sec.InitStack();
            //
            //
            var packetDebug = false;
            var eap         = BluetoothFactoryConfig.GetEntryAssemblyPath();

            if (eap != null)   // null if we're under unit-test or...
            {
                var dir      = Path.GetDirectoryName(eap);
                var filename = Path.Combine(dir, "DoPacketDebug.txt");
                if (File.Exists(filename))
                {
                    packetDebug = true;
                }
            }
            if (packetDebug)
            {
                _pdebug = new BluetopiaPacketDebug(this);
            }
            //
            InitApiVersion();
        }
Example #8
0
 BluetopiaError IBluetopiaApi.GAP_Initiate_Bonding(uint BluetoothStackID, BD_ADDR_BY_VALUE BD_ADDR,
                                                   StackConsts.GAP_Bonding_Type GAP_Bonding_Type,
                                                   NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(BluetopiaError.UNSUPPORTED_PLATFORM_ERROR);
 }
Example #9
0
 BluetopiaError IBluetopiaApi.GAP_Authenticate_Remote_Device(uint BluetoothStackID, Int64 BD_ADDR,
                                                             NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter)
 {
     return(BluetopiaError.UNSUPPORTED_PLATFORM_ERROR);
 }
Example #10
0
 internal static extern BluetopiaError GAP_Query_Remote_Device_Name(uint BluetoothStackID, BD_ADDR_BY_VALUE BD_ADDR,
                                                                    NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter);
Example #11
0
 internal static extern BluetopiaError GAP_Perform_Inquiry(uint BluetoothStackID, StackConsts.GAP_Inquiry_Type GAP_Inquiry_Type,
                                                           uint MinimumPeriodLength, uint MaximumPeriodLength,
                                                           uint InquiryLength, uint MaximumResponses,
                                                           NativeMethods.GAP_Event_Callback GAP_Event_Callback, uint CallbackParameter);
Example #12
0
 //--
 internal BluetopiaSecurity(BluetopiaFactory factory)
 {
     Debug.Assert(factory != null);
     _factory = factory;
     _AuthenticateCallback = new NativeMethods.GAP_Event_Callback(HandleAuthenticate_Callback);
 }