Example #1
0
 public BluetopiaSdpQuery(BluetopiaFactory factory)
 {
     Debug.Assert(factory != null);
     _fcty     = factory;
     _callback = HandleSDP_Response_Callback;
     _parser   = new ServiceRecordParser();
 }
Example #2
0
        internal BluetopiaPacketDebug(BluetopiaFactory fcty, Stream pcapFile)
        {
            _fcty    = fcty;
            _Handler = HandleDebug;
            var ret = NativeMethods.BSC_RegisterDebugCallback(_fcty.StackId, _Handler, 0);

            BluetopiaUtils.Assert(ret, "BSC_RegisterDebugCallback");
            //
            var hundNs = DateTime.UtcNow.Ticks;
            var msec   = Environment.TickCount;

            _tickTimeOffset = hundNs - msec * HundredNsInMsec;
#if RAW_FILE
            _dest = File.Create(@"\packets.dat");
#endif
            _destPcap = pcapFile;
            WritePcapGlobalHeader(_destPcap);
            //
#if DEBUG
            byte testIsByteRange = checked ((byte)StackConsts.HCI_PacketType.__HCIAdditional);
            _sharedBuf[0] = testIsByteRange; // shut-up compiler
#if !NETCF                                   // :-(
            Debug.Assert(new IntPtr(OffsetOfData) == Marshal.OffsetOf(
                             typeof(Structs.HCI_Packet), "_startOf_HCIPacketData"));
#endif
#endif
        }
Example #3
0
        internal static BluetopiaDeviceInfo CreateFromInquiry(
            Structs.GAP_Inquiry_Entry_Event_Data data, BluetopiaFactory factory)
        {
            var bdi = new BluetopiaDeviceInfo(factory,
                                              BluetopiaUtils.ToBluetoothAddress(data.BD_ADDR));

            bdi._cod = BluetopiaUtils.ToClassOfDevice(data.Class_of_Device);
            bdi._blockFindNameForNow = true;
            bdi._clockOffsetEtc      = new ClockOffsetEtc(data);
            return(bdi);
        }
Example #4
0
        public BluetopiaPlaying()
        {
            _hciCb = FnCallback;
            _fcty  = BluetoothFactory.GetTheFactoryOfTypeOrDefault <BluetopiaFactory>();
            if (_fcty == null)
            {
                throw new InvalidOperationException("No Bluetopia stack.");
            }
            var ret = NativeMethods.HCI_Register_Event_Callback(_fcty.StackId,
                                                                _hciCb, 0);

            BluetopiaUtils.CheckAndThrow(ret, "HCI_Register_Event_Callback");
        }
Example #5
0
        //NativeMethods.GAP_Event_Callback _gapEventCallback;

        // Access is ONLY throw the following factory methods!!!!!!
        private BluetopiaDeviceInfo(BluetopiaFactory factory, BluetoothAddress device)
        {
            // Access ONLY ONLY throw the following factory methods!!!!!!
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            _factory = factory;
            _addr    = device;
            //
            // HAC-K
            // TO-DO ?_connected: Use GAP_Query_Connection_Handle
            _connected = false; // shutUpCompiler
            Debug.Assert(_connected == false, "_connected");
        }
Example #6
0
        internal BluetopiaRadio(BluetopiaFactory factory)
        {
            _fcty = factory;
            byte[] bd_addr = new byte[StackConsts.BD_ADDR_SIZE];
            var    ret     = _fcty.Api.GAP_Query_Local_BD_ADDR(_fcty.StackId, bd_addr);

            BluetopiaUtils.CheckAndThrow(ret, "GAP_Query_Local_BD_ADDR");
            _addr = BluetopiaUtils.ToBluetoothAddress(bd_addr);
            //
            ReadName();
            //
            uint cod;

            ret = _fcty.Api.GAP_Query_Class_Of_Device(_fcty.StackId, out cod);
            BluetopiaUtils.CheckAndThrow(ret, "GAP_Query_Class_Of_Device");
            _cod = new ClassOfDevice(cod);
        }
Example #7
0
        internal static BluetopiaDeviceInfo CreateFromStored(BluetopiaFactory factory,
                                                             BluetoothAddress addr, string name, uint cod, bool paired)
        {
            var bdi = CreateFromGivenAddress(addr, factory);

            bdi._remembered = true;
            bdi._paired     = paired;
            if (!string.IsNullOrEmpty(name))
            {
#if DEBUG
                BluetoothAddress tmp;
                if (BluetoothAddress.TryParse(name, out tmp))
                {
                    Debug.Fail("Name is an address!");
                }
#endif
                bdi.SetName(name);
            }
            bdi._cod = new ClassOfDevice(cod);
            return(bdi);
        }
Example #8
0
 //----
 internal BluetopiaClient(BluetopiaFactory fcty)
     : base(fcty, new BluetopiaRfcommStream(fcty))
 {
     Debug.Assert(fcty != null, "fcty NULL!");
     _factory = fcty;
 }
Example #9
0
 //--
 internal BluetopiaListener(BluetopiaFactory factory)
     : base(factory)
 {
     _fcty = factory;
 }
Example #10
0
 internal BluetopiaRfcommStream(BluetopiaFactory factory)
 {
     Debug.Assert(factory != null, "factory NULL");
     _fcty         = factory;
     _callbackAAAA = HandleSPP_Event_Callback;
 }
Example #11
0
 //--------
 internal BluetopiaSdpCreator(BluetopiaFactory fcty)
 {
     Debug.Assert(fcty != null, "fcty NULL!");
     _fcty = fcty;
 }
Example #12
0
 internal BluetopiaPacketDebug(BluetopiaFactory fcty)
     : this(fcty, File.Create(@"\packets.pcap"))
 {
 }
Example #13
0
 //----
 internal static BluetopiaDeviceInfo CreateFromGivenAddress(BluetoothAddress addr, BluetopiaFactory factory)
 {
     return(new BluetopiaDeviceInfo(factory, addr));
 }
Example #14
0
 internal BluetopiaClient(BluetopiaFactory fcty, BluetoothEndPoint localEP)
     : this(fcty)
 {
     throw new NotSupportedException("Don't support binding to a particular local address/port.");
 }
Example #15
0
 //----
 internal BluetopiaInquiry(BluetopiaFactory fcty)
 {
     _fcty = fcty;
 }
Example #16
0
 internal BluetopiaClient(BluetopiaFactory fcty, CommonRfcommStream conn)
     : base(fcty, conn)
 {
     Debug.Assert(fcty != null, "fcty NULL!");
     _factory = fcty;
 }
Example #17
0
 //--
 internal BluetopiaSecurity(BluetopiaFactory factory)
 {
     Debug.Assert(factory != null);
     _factory = factory;
     _AuthenticateCallback = new NativeMethods.GAP_Event_Callback(HandleAuthenticate_Callback);
 }