Class: Argus::VideoStreamer
- Inherits:
-
Object
- Object
- Argus::VideoStreamer
- Defined in:
- lib/argus/video_streamer.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#tcp_socket ⇒ Object
readonly
Returns the value of attribute tcp_socket.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ VideoStreamer
constructor
A new instance of VideoStreamer.
- #receive_data ⇒ Object
- #start(udp_socket = nil) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ VideoStreamer
Returns a new instance of VideoStreamer.
7 8 9 10 11 |
# File 'lib/argus/video_streamer.rb', line 7 def initialize(opts={}) @host = opts[:host] || '192.168.1.1' @port = opts[:port] || 5555 @tcp_socket = opts[:socket] || TCPSocket.new(@host, @port) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/argus/video_streamer.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/argus/video_streamer.rb', line 5 def port @port end |
#tcp_socket ⇒ Object (readonly)
Returns the value of attribute tcp_socket.
5 6 7 |
# File 'lib/argus/video_streamer.rb', line 5 def tcp_socket @tcp_socket end |
Instance Method Details
#receive_data ⇒ Object
19 20 21 |
# File 'lib/argus/video_streamer.rb', line 19 def receive_data VideoData.new(tcp_socket) end |
#start(udp_socket = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/argus/video_streamer.rb', line 13 def start(udp_socket=nil) @udp_socket = udp_socket || UDPSocket.new @udp_socket.send("\x01\x00\x00\x00", 0, host, port) @udp_socket.close end |