示例#1
0
        private TivoEndPoint(string address, TivoConnectionMode mode, TivoServiceProvider serviceProvider, ICertificateStore certificateStore)
        {
            if (certificateStore == null)
            {
                throw new ArgumentNullException("certificateStore");
            }

            if (string.IsNullOrWhiteSpace(address))
            {
                throw new ArgumentNullException("address");
            }

            switch (serviceProvider)
            {
            case TivoServiceProvider.TivoUSA:
                this.rpcAppName    = "Quicksilver";
                this.rpcAppVersion = new Version(1, 2);
                break;

            case TivoServiceProvider.VirginMediaUK:
                this.rpcAppName    = "com.virginmedia.quicksilvervm";
                this.rpcAppVersion = new Version(2, 2);
                break;

            case TivoServiceProvider.Unknown:
            default:
                throw new ArgumentOutOfRangeException("service", "Must specify a valid service provider.");
            }

            this.serviceProvider  = serviceProvider;
            this.certificateStore = certificateStore;
            this.Address          = address;
            this.ConnectionMode   = mode;
        }
示例#2
0
        public async Task <JObject> Connect(TivoEndPoint endPoint, IDictionary <string, object> authMessage, int authMessageSchemaVersion)
        {
            this.connectionMode = endPoint.ConnectionMode;
            this.headerInfo     = (IMindRpcHeaderInfo)endPoint;

            this.sslStream = await this.networkInterface.Initialize(endPoint).ConfigureAwait(false);

            this.receiveSubject = new Subject <Tuple <int, JObject> >();

            // Send authentication message to the TiVo.
            var authTask = SendRequest(authMessage, authMessageSchemaVersion);

            // Start listening on the socket *after* the first send operation.
            // This stops errors occuring on WP7
            StartReceiveThread();

            return(await authTask);
        }
示例#3
0
 public void MessageFromServer(TivoConnectionMode mode, int schemaVersion, int rpcId, string type, string message)
 {
     WriteEvent(6, mode, schemaVersion, rpcId, type, message);
 }
示例#4
0
 public void ServerConnectionFailure(TivoConnectionMode mode, string exceptionText)
 {
     WriteEvent(4, mode, exceptionText);
 }
示例#5
0
 public void ServerConnectionFailure(TivoConnectionMode mode, Exception exception)
 {
     this.ServerConnectionFailure(mode, exception.ToString());
 }
示例#6
0
 public void ServerConnected(TivoConnectionMode mode, string serverAddress)
 {
     WriteEvent(3, mode, serverAddress);
 }
示例#7
0
 public void ClientConnectionFailure(TivoConnectionMode mode, string exceptionText)
 {
     WriteEvent(2, mode, exceptionText);
 }
示例#8
0
 public void ClientConnectionFailure(TivoConnectionMode mode, Exception exception)
 {
     this.ClientConnectionFailure(mode, exception.ToString());
 }
示例#9
0
 public void ClientConnected(TivoConnectionMode mode, string clientAddress, string streamProperties)
 {
     WriteEvent(1, mode, clientAddress, streamProperties);
 }
示例#10
0
        public static byte[] EncodeRequest(TivoConnectionMode mode, int sessionId, string tsn, int rpcId, int schemaVersion, IMindRpcHeaderInfo headerInfo, string requestType, string bodyText)
        {
            string headerText = CreateHeader(sessionId, tsn, rpcId, schemaVersion, headerInfo, requestType);

            return(EncodeMessage(headerText, bodyText));
        }