Class: Sonycam::Packet
- Inherits:
-
Object
- Object
- Sonycam::Packet
- Defined in:
- lib/sonycam/packet.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(commen_header, payload_header, jpeg_data, padding_data) ⇒ Packet
constructor
A new instance of Packet.
Constructor Details
#initialize(commen_header, payload_header, jpeg_data, padding_data) ⇒ Packet
Returns a new instance of Packet.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sonycam/packet.rb', line 3 def initialize commen_header, payload_header, jpeg_data, padding_data @packet = { commen_header: { start_byte: commen_header[0], # hex, fixed "FF" payload_type: commen_header[1], # int sequence_number: commen_header[2], # int time_stamp: commen_header[3] # int }, payload_header: { star_code: payload_header[0], # hex, fixed "24356879" jpeg_data_size: payload_header[1].hex, # int padding_size: payload_header[2], # int reserved: payload_header[3], # hex flag: payload_header[4], # int, fixed "00" reserved_2: payload_header[5] }, payload_data: { jpeg_data: jpeg_data, padding_data: padding_data } } end |
Instance Method Details
#[](key) ⇒ Object
26 27 28 |
# File 'lib/sonycam/packet.rb', line 26 def [] key @packet[key] end |