コード例 #1
0
ファイル: BluezDeviceInfo.cs プロジェクト: jehy/32feet.NET
 //----
 // Use factory method to create.
 private BluezDeviceInfo(BluezFactory fcty, BluetoothAddress addr)
 {
     Debug.Assert(fcty != null, "ArgNull");
     _fcty = fcty;
     Debug.Assert(addr != null, "ArgNull");
     _addr = addr;
     _cod  = new ClassOfDevice(0);
 }
コード例 #2
0
ファイル: BluezDeviceInfo.cs プロジェクト: jehy/32feet.NET
        internal static BluezDeviceInfo CreateFromInquiry(BluezFactory fcty, Structs.inquiry_info cur)
        {
            var addr = BluezUtils.ToBluetoothAddress(cur.bdaddr);
            var bdi  = new BluezDeviceInfo(fcty, addr);

            bdi._cod = BluezUtils.ToClassOfDevice(cur.dev_class);
            // Note the devices here aren't 'created' by BlueZ so no ObjectPath.
            // We'll lookup/create the device later if required.
            //
            return(bdi);
        }
コード例 #3
0
ファイル: BluezDeviceInfo.cs プロジェクト: jehy/32feet.NET
        internal static BluezDeviceInfo CreateFromStored(BluezFactory fcty,
                                                         ObjectPath objectPath,
                                                         BluetoothAddress address,
                                                         IDictionary <string, object> dbusDeviceDict)
        {
            var bdi = new BluezDeviceInfo(fcty, address);

            if (!_propDumped)
            {
                _propDumped = true;
                BluezUtils.DumpKeys(dbusDeviceDict);
                // "keys: Address, Name, Alias, Class, Icon, Paired, Trusted, Connected, UUIDs, Adapter"
            }
            SetProperties(objectPath, bdi, dbusDeviceDict);
            return(bdi);
        }
コード例 #4
0
ファイル: BluezDeviceInfo.cs プロジェクト: jehy/32feet.NET
        //----
        internal static BluezDeviceInfo CreateFromGivenAddress(BluezFactory fcty, BluetoothAddress address)
        {
            var        bdi = new BluezDeviceInfo(fcty, address);
            ObjectPath objectPath;
            var        dict = fcty.BluezDbus.FindDeviceProperties_OnDefaultAdapter(address, out objectPath);

            if (dict != null)
            {
                SetProperties(objectPath, bdi, dict);
            }
            else
            {
                Console.WriteLine("No dbus device properties.");
            }
            return(bdi);
        }
コード例 #5
0
        //----
        internal BluezRadio(BluezFactory fcty, int dd)
        {
            _dd = dd;
            Debug.Assert(fcty != null, "ArgNull");
            _fcty = fcty;
            BluezError ret;
            var        bdaddr = BluezUtils.FromBluetoothAddress(BluetoothAddress.None);

            ret = NativeMethods.hci_read_bd_addr(_dd, bdaddr, _fcty.StackTimeout);
            //TODO BluezUtils.CheckAndThrow(ret, "hci_read_bd_addr");
            BluezUtils.Assert(ret, "hci_read_bd_addr");
            if (BluezUtils.IsSuccess(ret))
            {
                _addr = BluezUtils.ToBluetoothAddress(bdaddr);
                Console.WriteLine("Radio SUCCESS, addr: " + _addr);
            }
            else
            {
                // NEVER used EXCEPT in the debugger if we skip the CheckandThrow above.
                _addr = BluetoothAddress.None;
                Console.WriteLine("Radio FAIL, addr: " + _addr);
            }
            _nameTmp = new byte[250];
            //
            // First find _objectPath. In the future we'll be passed this.
            var ax = _fcty.BluezDbus.FindAdapter(_addr, out _objectPath);

            Debug.Assert(_objectPath != null, "BluezRadio..ctor NOT _objectPath!=null");
            //--
            // Set Adapter.
            _adapter = GetAdapter(_objectPath);
            Console.WriteLine("Got adapter at .ctor.3.");
            //
            var    prop   = GetProperties();
            string addrDt = (string)prop[PropertyName.Address];
            var    addrD  = BluetoothAddress.Parse(addrDt);

            Utils.MiscUtils.AssertEquals(addrD, _addr);
            Console.WriteLine("Check DONE Radio..ctor. " + addrD + " vs " + _addr);
        }
コード例 #6
0
ファイル: BluezDeviceInfo.cs プロジェクト: jehy/32feet.NET
        internal static BluezDeviceInfo CreateFromInquiryLive(BluezFactory fcty,
                                                              IDictionary <string, object> dbusDeviceDict)
        {
            var addr = BluetoothAddress.Parse((string)dbusDeviceDict["Address"]);
            var bdi  = new BluezDeviceInfo(fcty, addr);

            // "keys: Address, Class, Icon, RSSI, Name, Alias, LegacyPairing, Paired"
            // Note the devices here aren't 'created' by BlueZ so no ObjectPath.
            // We'll lookup/create the device later if required.
            SetProperties(null, bdi, dbusDeviceDict);
            object value;

            if (dbusDeviceDict.TryGetValue("RSSI", out value))
            {
                // Int16--Console.WriteLine("RSSI type: " + value.GetType().Name);
                bdi._rssiAtInquiry = (int?)Convert.ToInt32(value);
            }
            else
            {
                Console.WriteLine("Where's the 'RSSI' property?!?");
            }
            //
            return(bdi);
        }
コード例 #7
0
ファイル: BluezSecurity.cs プロジェクト: zhubin-12/32feet
 //----
 internal BluezSecurity(BluezFactory fcty)
 {
     _fcty = fcty;
 }
コード例 #8
0
ファイル: BluezListener.cs プロジェクト: zhubin-12/32feet
 //----
 internal BluezListener(BluezFactory fcty)
     : base(fcty)
 {
     Debug.Assert(fcty != null, "ArgNull");
     //_fcty = fcty;
 }
コード例 #9
0
 public BluezSdpQuery(BluezFactory factory)
 {
     Debug.Assert(factory != null);
     //_fcty = factory;
     _parser = new ServiceRecordParser();
 }
コード例 #10
0
 internal BluezClient(BluezFactory fcty, System.Net.Sockets.Socket acceptedSocket)
     : base(fcty, acceptedSocket)
 {
     _fcty = fcty;
 }
コード例 #11
0
 internal BluezClient(BluezFactory fcty, BluetoothEndPoint localEP)
     : base(fcty, localEP)
 {
     _fcty = fcty;
     //TODO _radio = _fcty.GetAdapterWithAddress(localEP.DeviceAddress);
 }
コード例 #12
0
 internal BluezClient(BluezFactory fcty)
     : base(fcty)
 {
     _fcty = fcty;
 }
コード例 #13
0
 //----
 internal BluezDbus(BluezFactory fcty)
 {
     _fcty = fcty;
     //
     KeepDefaultAdapterAndRegisterForSignals();
 }
コード例 #14
0
 internal BluezL2CapClient(BluezFactory fcty, BluetoothEndPoint localEP)
     : base(fcty, localEP)
 {
     _fcty = fcty;
 }