Beispiel #1
0
        /// <summary>
        /// Connect to Qwerk.
        /// </summary>
        ///
        /// <param name="hostAddress">Qwerk's address or host name to connect to.</param>
        ///
        /// <exception cref="ConnectionFailedException">Failed connecting to Qwerk.</exception>
        /// <exception cref="ServiceAccessFailedException">Failed accessing to the requested service,
        /// which may be due to the fact that something is wrong with Qwerk device or connection
        /// was initiated not with Qwerk.</exception>
        ///
        public void Connect(string hostAddress)
        {
            // close previous connection
            Disconnect( );

            try
            {
                // initialize ICE communication
                iceCommunicator = Ice.Util.initialize( );


                // get Qwerk object
                Ice.ObjectPrx obj = iceCommunicator.stringToProxy("'::TeRK::TerkUser':tcp -h " + hostAddress + " -p 10101");
                obj   = obj.ice_timeout(TimeOut);
                qwerk = TeRKIceLib.QwerkPrxHelper.checkedCast(obj);
            }
            catch
            {
                Disconnect( );

                throw new ConnectionFailedException("Failed connecting to the requested service.");
            }

            // check if qwerk's object was obtained successfully
            if (qwerk == null)
            {
                Disconnect( );

                throw new ServiceAccessFailedException("Failed accessing to the requested service.");
            }
            else
            {
                // save host address
                this.hostAddress = hostAddress;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Connect to Qwerk.
        /// </summary>
        /// 
        /// <param name="hostAddress">Qwerk's address or host name to connect to.</param>
        /// 
        /// <exception cref="ConnectionFailedException">Failed connecting to Qwerk.</exception>
        /// <exception cref="ServiceAccessFailedException">Failed accessing to the requested service,
        /// which may be due to the fact that something is wrong with Qwerk device or connection
        /// was initiated not with Qwerk.</exception>
        /// 
        public void Connect( string hostAddress )
        {
            // close previous connection
            Disconnect( );

            try
            {
                // initialize ICE communication
                iceCommunicator = Ice.Util.initialize( );
                

                // get Qwerk object
                Ice.ObjectPrx obj = iceCommunicator.stringToProxy( "'::TeRK::TerkUser':tcp -h " + hostAddress + " -p 10101" );
                obj = obj.ice_timeout( TimeOut );
                qwerk = TeRKIceLib.QwerkPrxHelper.checkedCast( obj );

            }
            catch
            {
                Disconnect( );

                throw new ConnectionFailedException( "Failed connecting to the requested service." );
            }

            // check if qwerk's object was obtained successfully
            if ( qwerk == null )
            {
                Disconnect( );

                throw new ServiceAccessFailedException( "Failed accessing to the requested service." );
            }
            else
            {
                // save host address
                this.hostAddress = hostAddress;
            }
        }