Пример #1
0
        //----
        protected override BluetoothEndPoint PrepareBindEndPoint(BluetoothEndPoint serverEP_)
        {
            Console.WriteLine("Calling BluezRfcommEndPoint.CreateBindEndPoint");
            var bindEP = BluezRfcommEndPoint.CreateBindEndPoint(serverEP_);

            // Win32 uses -1 for 'auto assign' but BlueZ uses 0.
            if (serverEP_.Port == -1)
            {
                serverEP_.Port = 0;
            }
            else if (serverEP_.Port > BluetoothEndPoint.MaxScn)
            {
                // BlueZ doesn't complain in this case!  Do't know what it does...
                throw new SocketException((int)SocketError.AddressNotAvailable);
            }
            Debug.Assert(bindEP.Address == serverEP_.Address, "Address DIFF");
            Debug.Assert(bindEP.Port == serverEP_.Port, "Port DIFF");
            return(bindEP);
        }
Пример #2
0
        internal static BluezRfcommEndPoint CreateBindEndPoint(BluetoothEndPoint serverEP)
        {
            int port;

            // Win32 uses -1 for 'auto assign' but BlueZ uses 0.
            if (serverEP.Port == -1)   // TODO ! Test on L2CAP
            {
                port = 0;
                //TODO } else if (serverEP.Port > BluetoothEndPoint.MaxScn PSM!!) {
                //    // BlueZ doesn't complain in this case!  Do't know what it does...
                //    throw new SocketException((int)SocketError.AddressNotAvailable);
            }
            else
            {
                port = serverEP.Port;
            }
            var l2capEp = new BluezRfcommEndPoint(serverEP.Address, port);

            return(l2capEp);
        }
Пример #3
0
 protected override BluetoothEndPoint PrepareBindEndPoint(BluetoothEndPoint serverEP)
 {
     Console.WriteLine("Calling BluezRfcommEndPoint.CreateBindEndPoint");
     return(BluezRfcommEndPoint.CreateBindEndPoint(serverEP));
 }