Class: Cosmos::TcpipClientInterface
- Inherits:
-
StreamInterface
- Object
- Interface
- StreamInterface
- Cosmos::TcpipClientInterface
- Defined in:
- lib/cosmos/interfaces/tcpip_client_interface.rb
Overview
Base class for interfaces that act as a TCP/IP client
Direct Known Subclasses
Constant Summary
Constants included from Extract
Extract::SCANNING_REGULAR_EXPRESSION
Instance Attribute Summary
Attributes inherited from Interface
#auto_reconnect, #bytes_read, #bytes_written, #connect_on_startup, #disable_disconnect, #interfaces, #name, #num_clients, #options, #packet_log_writer_pairs, #raw_logger_pair, #read_count, #read_queue_size, #reconnect_delay, #routers, #target_names, #thread, #write_count, #write_queue_size
Instance Method Summary collapse
-
#connect ⇒ Object
Connects the StreamProtocol to a TcpipClientStream by passing the initialization parameters to the TcpipClientStream.
-
#initialize(hostname, write_port, read_port, write_timeout, read_timeout, stream_protocol_type, *stream_protocol_args) ⇒ TcpipClientInterface
constructor
A new instance of TcpipClientInterface.
Methods inherited from StreamInterface
#bytes_read, #bytes_read=, #bytes_written, #bytes_written=, #connected?, #disconnect, #post_read_data, #post_read_packet, #pre_write_packet, #read, #write, #write_raw
Methods inherited from Interface
#connected?, #copy_to, #disconnect, #post_identify_packet, #read, #read_allowed?, #set_option, #start_raw_logging, #stop_raw_logging, #write, #write_allowed?, #write_raw, #write_raw_allowed?
Methods included from Api
#cmd, #cmd_no_checks, #cmd_no_hazardous_check, #cmd_no_range_check, #cmd_raw, #cmd_raw_no_checks, #cmd_raw_no_hazardous_check, #cmd_raw_no_range_check, #connect_interface, #connect_router, #disable_limits, #disable_limits_group, #disconnect_interface, #disconnect_router, #enable_limits, #enable_limits_group, #get_cmd_hazardous, #get_cmd_list, #get_cmd_log_filename, #get_cmd_param_list, #get_cmd_time, #get_cmd_value, #get_interface_names, #get_limits, #get_limits_event, #get_limits_groups, #get_limits_set, #get_limits_sets, #get_out_of_limits, #get_overall_limits_state, #get_packet_data, #get_router_names, #get_server_message_log_filename, #get_stale, #get_target_list, #get_tlm_details, #get_tlm_item_list, #get_tlm_list, #get_tlm_log_filename, #get_tlm_packet, #get_tlm_values, #interface_state, #limits_enabled?, #map_target_to_interface, #router_state, #send_raw, #set_limits, #set_limits_set, #set_tlm, #set_tlm_raw, #start_cmd_log, #start_logging, #start_new_server_message_log, #start_raw_logging_interface, #start_raw_logging_router, #start_tlm_log, #stop_cmd_log, #stop_logging, #stop_raw_logging_interface, #stop_raw_logging_router, #stop_tlm_log, #subscribe_limits_events, #subscribe_packet_data, #tlm, #tlm_formatted, #tlm_raw, #tlm_variable, #tlm_with_units, #unsubscribe_limits_events, #unsubscribe_packet_data
Constructor Details
#initialize(hostname, write_port, read_port, write_timeout, read_timeout, stream_protocol_type, *stream_protocol_args) ⇒ TcpipClientInterface
Returns a new instance of TcpipClientInterface.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cosmos/interfaces/tcpip_client_interface.rb', line 26 def initialize(hostname, write_port, read_port, write_timeout, read_timeout, stream_protocol_type, *stream_protocol_args) super(stream_protocol_type, *stream_protocol_args) @hostname = hostname @write_port = ConfigParser.handle_nil(write_port) @read_port = ConfigParser.handle_nil(read_port) @write_timeout = write_timeout @read_timeout = read_timeout @read_allowed = false unless @read_port @write_allowed = false unless @write_port @write_raw_allowed = false unless @write_port end |
Instance Method Details
#connect ⇒ Object
Connects the StreamProtocol to a Cosmos::TcpipClientStream by passing the initialization parameters to the Cosmos::TcpipClientStream.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cosmos/interfaces/tcpip_client_interface.rb', line 47 def connect stream = TcpipClientStream.new( @hostname, @write_port, @read_port, @write_timeout, @read_timeout) stream.raw_logger_pair = @raw_logger_pair @stream_protocol.connect(stream) end |