Sha256: 0a0882f6e2ae2454c9e7f800e3574d18f2502567345fa733a85e3c03dde9b8d9
Contents?: true
Size: 858 Bytes
Versions: 2
Compression:
Stored size: 858 Bytes
Contents
require 'movingsign_api/commands/write_control_command' module MovingsignApi # Sets the signs date + time class SetClockCommand < WriteControlCommand # @return [Time] attr_accessor :datetime def subcommand_code 'A' end private def subcommand_payload_bytes bytes = [] # date bytes.concat string_to_ascii_bytes(self.datetime.year) bytes.concat string_to_ascii_bytes('%02d' % self.datetime.month) bytes.concat string_to_ascii_bytes('%02d' % self.datetime.day) # time bytes.concat string_to_ascii_bytes('%02d' % self.datetime.hour) bytes.concat string_to_ascii_bytes('%02d' % self.datetime.min) bytes.concat string_to_ascii_bytes('%02d' % self.datetime.sec) # day of week bytes.concat string_to_ascii_bytes(self.datetime.wday) bytes end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
movingsign_api-0.0.2 | lib/movingsign_api/commands/set_clock_command.rb |
movingsign_api-0.0.1 | lib/movingsign_api/commands/set_clock_command.rb |