How to get DeviceAddress property and LastSeenTime property in c++/winrt

  • Thread starter Thread starter 夸父
  • Start date Start date

夸父

Guest
Windows::Devices::Enumeration::DeviceInformation m_deviceInformation
auto ass = m_deviceInformation.Properties().TryLookup(L"System.Devices.Aep.DeviceAddress");
if (ass)
{
unbox_value< ? >(ass);
}

auto value = m_deviceInformation.Properties().TryLookup(L"System.Devices.Aep.Bluetooth.LastSeenTime");
if(value)
{
unbox_value<Windows::System::DateTimeSettings>(value);
}

I'm using c++/winrt to get bluetooth information.

I know how to get DeviceAddress property and LastSeenTime property in cshap.

if(DeviceInfo.Properties.ContainsKey("System.Devices.Aep.DeviceAddress"))
{
BluetoothAddressAsString = ret = DeviceInfo.Properties["System.Devices.Aep.DeviceAddress"].ToString();
BluetoothAddressAsUlong = Convert.ToUInt64(BluetoothAddressAsString.Replace(":", String.Empty), 16);
}


if (DeviceInfo.Properties.ContainsKey("System.Devices.Aep.Bluetooth.LastSeenTime") && (DeviceInfo.Properties["System.Devices.Aep.Bluetooth.LastSeenTime"] != null))
{
LastSeenTime = ((System.DateTimeOffset)DeviceInfo.Properties["System.Devices.Aep.Bluetooth.LastSeenTime"]).UtcDateTime;
}


but how to get them in c++/winrt.



夸父

Continue reading...
 
Back
Top