// 32feet.NET - Personal Area Networking for .NET
//
// InTheHand.Net.Bluetooth.BLUETOOTH_SELECT_DEVICE_PARAMS
//
// Copyright (c) 2003-2006 In The Hand Ltd, All rights reserved.
// This source code is licensed under the In The Hand Community License - see License.txt
using System;
using System.Runtime.InteropServices;
namespace InTheHand.Net.Bluetooth{
internal struct BLUETOOTH_SELECT_DEVICE_PARAMS : InTheHand.Windows.Forms.ISelectBluetoothDevice
{
int dwSize;
int cNumOfClasses;
IntPtr /*BLUETOOTH_COD_PAIRS*/ prgClassOfDevices;
#if V2
[MarshalAs(UnmanagedType.LPWStr)]
#endif
string pszInfo;
public IntPtr hwndParent;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fForceAuthentication;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fShowAuthenticated;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fShowRemembered;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fShowUnknown;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fAddNewDeviceWizard;
#if V2
[MarshalAs(UnmanagedType.Bool)]
#endif
bool fSkipServicesPage;
IntPtr pfnDeviceCallback;
IntPtr pvParam;
public int cNumDevices;
public IntPtr pDevices;
public void Reset()
{
dwSize = Marshal.SizeOf(this);
cNumOfClasses = 0;
prgClassOfDevices = IntPtr.Zero;
pszInfo = null;
hwndParent = IntPtr.Zero;
fForceAuthentication = false;
fShowAuthenticated = true;
fShowRemembered = true;
fShowUnknown = true;
fAddNewDeviceWizard = false;
fSkipServicesPage = false;
pfnDeviceCallback = IntPtr.Zero;
pvParam = IntPtr.Zero;
cNumDevices = 0;
pDevices = IntPtr.Zero;
}
public BLUETOOTH_DEVICE_INFO[] Devices
{
get
{
if (cNumDevices > 0)
{
BLUETOOTH_DEVICE_INFO[] devs = new BLUETOOTH_DEVICE_INFO[cNumDevices];
for (int idevice = 0; idevice < cNumDevices; idevice++)
{
devs[idevice] = (BLUETOOTH_DEVICE_INFO)Marshal.PtrToStructure(new IntPtr(pDevices.ToInt64() + (idevice * Marshal.SizeOf(typeof(BLUETOOTH_DEVICE_INFO)))), typeof(BLUETOOTH_DEVICE_INFO));
}
return devs;
}
return new BLUETOOTH_DEVICE_INFO[0];
}
}
public BLUETOOTH_DEVICE_INFO Device
{
get
{
if (cNumDevices > 0)
{
BLUETOOTH_DEVICE_INFO device = (BLUETOOTH_DEVICE_INFO)Marshal.PtrToStructure(pDevices, typeof(BLUETOOTH_DEVICE_INFO));
return device;
}
return new BLUETOOTH_DEVICE_INFO();
}
}
#region ISelectBluetoothDevice Members
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.ShowAuthenticated
{
get { return fShowAuthenticated; }
set { fShowAuthenticated = value; }
}
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.ShowRemembered
{
get { return fShowRemembered; }
set { fShowRemembered = value; }
}
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.ShowUnknown
{
get { return fShowUnknown; }
set { fShowUnknown = value; }
}
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.ForceAuthentication
{
get { return fForceAuthentication; }
set { fForceAuthentication = value; }
}
#if WinXP
string InTheHand.Windows.Forms.ISelectBluetoothDevice.Info
{
get { return pszInfo; }
set { pszInfo = value; }
}
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.AddNewDeviceWizard
{
get { return fAddNewDeviceWizard; }
set { fAddNewDeviceWizard = value; }
}
bool InTheHand.Windows.Forms.ISelectBluetoothDevice.SkipServicesPage
{
get { return fSkipServicesPage; }
set { fSkipServicesPage = value; }
}
#endif
#endregion
}
}
|