Beispiel #1
0
		public static IOBluetoothDevice GetDeviceWithAddress (BluetoothDeviceAddress address)
		{
			var addressPtr = Marshal.AllocHGlobal (Marshal.SizeOf (address));
			try {
				Marshal.StructureToPtr (address, addressPtr, false);
				return getDeviceWithAddress (addressPtr);
			} finally {
				Marshal.FreeHGlobal (addressPtr);
			}
		}
Beispiel #2
0
        public static IOBluetoothDevice GetDeviceWithAddress(BluetoothDeviceAddress address)
        {
            var addressPtr = Marshal.AllocHGlobal(Marshal.SizeOf(address));

            try {
                Marshal.StructureToPtr(address, addressPtr, false);
                return(getDeviceWithAddress(addressPtr));
            } finally {
                Marshal.FreeHGlobal(addressPtr);
            }
        }
Beispiel #3
0
        public IOBluetoothDeviceSearchDeviceAttributes(
            BluetoothDeviceAddress address,
            string name,
            BluetoothServiceClassMajor serviceClassMajor,
            BluetoothDeviceClassMajor deviceClassMajor,
            BluetoothDeviceClassMinor deviceClassMinor)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (Encoding.UTF8.GetByteCount(name) > 256)
            {
                throw new ArgumentOutOfRangeException("name is too long");
            }

            this.address = address;
            this.name    = new byte[256];
            Encoding.UTF8.GetBytes(name, 0, name.Length, this.name, 0);
            this.serviceClassMajor = serviceClassMajor;
            this.deviceClassMajor  = deviceClassMajor;
            this.deviceClassMinor  = deviceClassMinor;
        }
Beispiel #4
0
 public static NSString ToNSString(this BluetoothDeviceAddress deviceAddress)
 {
     return((NSString)Runtime.GetNSObject(IOBluetoothNSStringFromDeviceAddress(deviceAddress)));
 }
Beispiel #5
0
 extern static IntPtr IOBluetoothNSStringFromDeviceAddress([MarshalAs(UnmanagedType.LPStruct)] BluetoothDeviceAddress deviceAddress);
Beispiel #6
0
 extern static IOReturn IOBluetoothNSStringToDeviceAddress(IntPtr inNameString, out BluetoothDeviceAddress outDeviceAddress);
Beispiel #7
0
		extern static IOReturn IOBluetoothNSStringToDeviceAddress (IntPtr inNameString, out BluetoothDeviceAddress outDeviceAddress);
Beispiel #8
0
		public IOBluetoothDeviceSearchDeviceAttributes (
			BluetoothDeviceAddress address,
			string name,
			BluetoothServiceClassMajor serviceClassMajor,
			BluetoothDeviceClassMajor deviceClassMajor,
			BluetoothDeviceClassMinor deviceClassMinor)
		{
			if (name == null)
				throw new ArgumentNullException ("name");
			if (Encoding.UTF8.GetByteCount (name) > 256)
				throw new ArgumentOutOfRangeException ("name is too long");

			this.address = address;
			this.name = new byte[256];
			Encoding.UTF8.GetBytes (name, 0, name.Length, this.name, 0);
			this.serviceClassMajor = serviceClassMajor;
			this.deviceClassMajor = deviceClassMajor;
			this.deviceClassMinor = deviceClassMinor;
		}