Class: Argus::VideoStreamer

Inherits:
Object
  • Object
show all
Defined in:
lib/argus/video_streamer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'lib/argus/video_streamer.rb', line 5

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/argus/video_streamer.rb', line 5

def port
  @port
end

#tcp_socketObject (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_dataObject



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