//---- // 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); }
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); }
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); }
//---- 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); }
//---- 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); }
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); }
//---- internal BluezSecurity(BluezFactory fcty) { _fcty = fcty; }
//---- internal BluezListener(BluezFactory fcty) : base(fcty) { Debug.Assert(fcty != null, "ArgNull"); //_fcty = fcty; }
public BluezSdpQuery(BluezFactory factory) { Debug.Assert(factory != null); //_fcty = factory; _parser = new ServiceRecordParser(); }
internal BluezClient(BluezFactory fcty, System.Net.Sockets.Socket acceptedSocket) : base(fcty, acceptedSocket) { _fcty = fcty; }
internal BluezClient(BluezFactory fcty, BluetoothEndPoint localEP) : base(fcty, localEP) { _fcty = fcty; //TODO _radio = _fcty.GetAdapterWithAddress(localEP.DeviceAddress); }
internal BluezClient(BluezFactory fcty) : base(fcty) { _fcty = fcty; }
//---- internal BluezDbus(BluezFactory fcty) { _fcty = fcty; // KeepDefaultAdapterAndRegisterForSignals(); }
internal BluezL2CapClient(BluezFactory fcty, BluetoothEndPoint localEP) : base(fcty, localEP) { _fcty = fcty; }