public TerkServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
        {
            this.peerUserId = peerUserId;
             this.communicator = communicator;

             // get the collection of supported services from the peer's proxy
             //
             // Ugly hack to handle peers who don't support the getSupportedServices() method in the API.  This hack assumes
             // that the peer is a Qwerk, but that's ok for now since all non-qwerk TerkUsers already do support the new API.
             // TODO: remove this ugliness once we can assume that all TerkUsers support the new API.
             ProxyTypeIdToIdentityMap typeIdToProxyIdentityMap;
             try
            {
            typeIdToProxyIdentityMap = peerObjectPrx.getSupportedServices();
            }
             catch (Exception e)
            {
            Trace.TraceError("Exception while calling getSupportedServices()--maybe this TerkUser doesn't support the new API?", e);

            // assume we're dealing with a qwerk
            typeIdToProxyIdentityMap = QwerkPrxHelper.uncheckedCast(peerObjectPrx).getCommandControllerTypeToProxyIdentityMap();
            }

             if (typeIdToProxyIdentityMap != null)
            {
            foreach (DictionaryEntry entry in typeIdToProxyIdentityMap)
               {
               string key = (string) entry.Key;
               Identity value = (Identity) entry.Value;
               supportedServices.Add(key, value);
               }
            }
        }
Пример #2
0
        public TerkServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
        {
            this.peerUserId   = peerUserId;
            this.communicator = communicator;

            // get the collection of supported services from the peer's proxy
            //
            // Ugly hack to handle peers who don't support the getSupportedServices() method in the API.  This hack assumes
            // that the peer is a Qwerk, but that's ok for now since all non-qwerk TerkUsers already do support the new API.
            // TODO: remove this ugliness once we can assume that all TerkUsers support the new API.
            ProxyTypeIdToIdentityMap typeIdToProxyIdentityMap;

            try
            {
                typeIdToProxyIdentityMap = peerObjectPrx.getSupportedServices();
            }
            catch (Exception e)
            {
                Trace.TraceError("Exception while calling getSupportedServices()--maybe this TerkUser doesn't support the new API?", e);

                // assume we're dealing with a qwerk
                typeIdToProxyIdentityMap = QwerkPrxHelper.uncheckedCast(peerObjectPrx).getCommandControllerTypeToProxyIdentityMap();
            }

            if (typeIdToProxyIdentityMap != null)
            {
                foreach (DictionaryEntry entry in typeIdToProxyIdentityMap)
                {
                    string   key   = (string)entry.Key;
                    Identity value = (Identity)entry.Value;
                    supportedServices.Add(key, value);
                }
            }
        }
Пример #3
0
        public QwerkController(string qwerkUserId, QwerkPrx qwerkProxy, TerkCommunicator communicator)
        {
            this.qwerkProxy = qwerkProxy;
             ServiceProvider serviceProvider = ServiceProviderFactory.getFactory().createServiceProvider(qwerkUserId,
                                                                                                     qwerkProxy,
                                                                                                     communicator);

             ServiceFactory serviceFactory = new QwerkServiceFactory(qwerkProxy);
             // note: the AnalogInputsService is created differently since there isn't really a service of type
             // AnalogInputsService.TYPE_ID.  Currently, the only way to get analog data is from Qwerk's getState() method. So,
             // we use a special service factory (QwerkServiceFactory) which has a reference to the Qwerk proxy which is used
             // to create the AnalogInputsService.  This hackishness will change once we fix the API to fully support all
             // services (if you poke through the code, you'll see that the DigitalIOService is a bit of a hack, too).
             analogInputsService = (AnalogInputsService) serviceFactory.createService(AnalogInputsService.TYPE_ID, null);
             digitalIOService = (DigitalIOService) serviceProvider.getService(DigitalIOService.TYPE_ID, serviceFactory);
             motorService = (MotorService)serviceProvider.getService(MotorService.TYPE_ID, serviceFactory);
             servoService = (ServoService)serviceProvider.getService(ServoService.TYPE_ID, serviceFactory);
             videoStreamService = (VideoStreamService)serviceProvider.getService(VideoStreamService.TYPE_ID, serviceFactory);
        }
        public QwerkController(string qwerkUserId, QwerkPrx qwerkProxy, TerkCommunicator communicator)
        {
            this.qwerkProxy = qwerkProxy;
            ServiceProvider serviceProvider = ServiceProviderFactory.getFactory().createServiceProvider(qwerkUserId,
                                                                                                        qwerkProxy,
                                                                                                        communicator);

            ServiceFactory serviceFactory = new QwerkServiceFactory(qwerkProxy);

            // note: the AnalogInputsService is created differently since there isn't really a service of type
            // AnalogInputsService.TYPE_ID.  Currently, the only way to get analog data is from Qwerk's getState() method. So,
            // we use a special service factory (QwerkServiceFactory) which has a reference to the Qwerk proxy which is used
            // to create the AnalogInputsService.  This hackishness will change once we fix the API to fully support all
            // services (if you poke through the code, you'll see that the DigitalIOService is a bit of a hack, too).
            analogInputsService = (AnalogInputsService)serviceFactory.createService(AnalogInputsService.TYPE_ID, null);
            digitalIOService    = (DigitalIOService)serviceProvider.getService(DigitalIOService.TYPE_ID, serviceFactory);
            motorService        = (MotorService)serviceProvider.getService(MotorService.TYPE_ID, serviceFactory);
            servoService        = (ServoService)serviceProvider.getService(ServoService.TYPE_ID, serviceFactory);
            videoStreamService  = (VideoStreamService)serviceProvider.getService(VideoStreamService.TYPE_ID, serviceFactory);
        }
 public override ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
 {
     return(new TerkServiceProvider(peerUserId, peerObjectPrx, communicator));
 }
 public override ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
 {
     return new TerkServiceProvider(peerUserId, peerObjectPrx, communicator);
 }
Пример #7
0
 public abstract ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator);
 public abstract ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator);