Esempio n. 1
0
        static ObexWebRequest()
        {
            PlatformVerification.ThrowException();

            //register the obex schemes with the WebRequest base method
            ObexWebRequestCreate owrc = new ObexWebRequestCreate();

            WebRequest.RegisterPrefix(SchemeNames.Default, owrc);
            WebRequest.RegisterPrefix(SchemeNames.Push, owrc);
            WebRequest.RegisterPrefix(SchemeNames.Ftp, owrc);
            WebRequest.RegisterPrefix(SchemeNames.Sync, owrc);
        }
Esempio n. 2
0
        private ObexListener(ObexTransport transport, BluetoothPublicFactory factory)
        {
#if NETCF
            PlatformVerification.ThrowException();
#endif
            _btFactory = factory;
            switch (transport)
            {
            case ObexTransport.Bluetooth:
                ServiceRecord record = CreateServiceRecord();
                if (_btFactory == null)
                {
                    bListener = new BluetoothListener(BluetoothService.ObexObjectPush, record);
                }
                else
                {
                    bListener = _btFactory.CreateBluetoothListener(BluetoothService.ObexObjectPush, record);
                }
                bListener.ServiceClass = ServiceClass.ObjectTransfer;
                break;

            case ObexTransport.IrDA:
#if NO_IRDA
                throw new NotSupportedException("No IrDA on this platform.");
#else
                iListener = new IrDAListener("OBEX");
                break;
#endif
            case ObexTransport.Tcp:
                tListener = new TcpListener(IPAddress.Any, 650);
                break;

            default:
                throw new ArgumentException("Invalid transport specified");
            }
            this.transport = transport;
        }