/// <summary>
            /// Initializes a new instance of the <see cref="Qwerk.DigitalIn"/> class.
            /// </summary>
            /// 
            /// <param name="qwerk">Reference to <see cref="Qwerk"/> object, which is connected to Qwerk board.</param>
            /// 
            /// <exception cref="NotConnectedException">The passed reference to <see cref="Qwerk"/> object is not connected to
            /// Qwerk board.</exception>
            /// <exception cref="ConnectionFailedException">Failed connecting to the requested service.</exception>
            /// <exception cref="ServiceAccessFailedException">Failed accessing to the requested service.</exception>
            /// 
            public DigitalIn( Qwerk qwerk )
            {
                string hostAddress = qwerk.HostAddress;

                // check if connection was established
                if ( hostAddress != null )
                {
                    try
                    {
                        Ice.ObjectPrx obj = qwerk.iceCommunicator.stringToProxy( "'::TeRK::DigitalInController':tcp -h " + hostAddress + " -p 10101" );
                        obj = obj.ice_timeout( Qwerk.TimeOut );
                        digitalInController = TeRKIceLib.DigitalInControllerPrxHelper.checkedCast( obj );
                    }
                    catch ( Ice.ObjectNotExistException )
                    {
                        // the object does not exist on the host
                        throw new ServiceAccessFailedException( "Failed accessing to the requested service." );
                    }
                    catch
                    {
                        throw new ConnectionFailedException( "Failed connecting to the requested service." );
                    }

                    if ( digitalInController == null )
                    {
                        throw new ServiceAccessFailedException( "Failed accessing to the requested cervice." );
                    }
                }
                else
                {
                    throw new NotConnectedException( "Qwerk object is not connected to a board." );
                }
            }
Exemplo n.º 2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Qwerk.DigitalIn"/> class.
            /// </summary>
            ///
            /// <param name="qwerk">Reference to <see cref="Qwerk"/> object, which is connected to Qwerk board.</param>
            ///
            /// <exception cref="NotConnectedException">The passed reference to <see cref="Qwerk"/> object is not connected to
            /// Qwerk board.</exception>
            /// <exception cref="ConnectionFailedException">Failed connecting to the requested service.</exception>
            /// <exception cref="ServiceAccessFailedException">Failed accessing to the requested service.</exception>
            ///
            public DigitalIn(Qwerk qwerk)
            {
                string hostAddress = qwerk.HostAddress;

                // check if connection was established
                if (hostAddress != null)
                {
                    try
                    {
                        Ice.ObjectPrx obj = qwerk.iceCommunicator.stringToProxy("'::TeRK::DigitalInController':tcp -h " + hostAddress + " -p 10101");
                        obj = obj.ice_timeout(Qwerk.TimeOut);
                        digitalInController = TeRKIceLib.DigitalInControllerPrxHelper.checkedCast(obj);
                    }
                    catch (Ice.ObjectNotExistException)
                    {
                        // the object does not exist on the host
                        throw new ServiceAccessFailedException("Failed accessing to the requested service.");
                    }
                    catch
                    {
                        throw new ConnectionFailedException("Failed connecting to the requested service.");
                    }

                    if (digitalInController == null)
                    {
                        throw new ServiceAccessFailedException("Failed accessing to the requested cervice.");
                    }
                }
                else
                {
                    throw new NotConnectedException("Qwerk object is not connected to a board.");
                }
            }
Exemplo n.º 3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Qwerk.Video"/> class.
            /// </summary>
            ///
            /// <param name="qwerk">Reference to <see cref="Qwerk"/> object, which is connected to Qwerk board.</param>
            ///
            /// <exception cref="NotConnectedException">The passed reference to <see cref="Qwerk"/> object is not connected to
            /// Qwerk board.</exception>
            /// <exception cref="ConnectionFailedException">Failed connecting to the requested service.</exception>
            /// <exception cref="ServiceAccessFailedException">Failed accessing to the requested service.</exception>
            ///
            public Video(Qwerk qwerk)
            {
                string hostAddress = qwerk.HostAddress;

                // check if connection was established
                if (hostAddress != null)
                {
                    try
                    {
                        // prepare video source string
                        source = "'::TeRK::VideoStreamerServer':tcp -h " + hostAddress + " -p 10101";

                        var obj = qwerk.iceCommunicator.stringToProxy(source);
                        obj           = obj.ice_timeout(Qwerk.TimeOut);
                        videoStreamer = TeRKIceLib.VideoStreamerServerPrxHelper.checkedCast(obj);
                    }
                    catch (Ice.ObjectNotExistException)
                    {
                        // the object does not exist on the host
                        throw new ServiceAccessFailedException("Failed accessing to the requested service.");
                    }
                    catch
                    {
                        throw new ConnectionFailedException("Failed connecting to the requested service.");
                    }

                    if (videoStreamer == null)
                    {
                        throw new ServiceAccessFailedException("Failed accessing to the requested cervice.");
                    }
                }
                else
                {
                    throw new NotConnectedException("Qwerk object is not connected to a board.");
                }
            }