Sha256: ad9ac9ee544dbc064db950a865fd33b3e2d403bbea0481c05edc83ceca977cb8
Contents?: true
Size: 994 Bytes
Versions: 2
Compression:
Stored size: 994 Bytes
Contents
module MaxCube module Messages module TCP class Serializer module MessageZ private KEYS = %i[time scope].freeze OPT_KEYS = %i[id].freeze # Wakeup command # Acknowledgement (A) follows def serialize_tcp_z(hash) time = format('%02x', to_int(0, 'time', hash[:time])) scope = hash[:scope].to_sym scope = case scope when :group, :room 'G' when :all 'A' when :device 'D' else raise InvalidMessageBody.new(@msg_type, "invalid scope: #{scope}") end args = [time, scope] args << format('%02x', to_int(0, 'ID', hash[:id])) if hash.key?(:id) args.join(',') end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maxcube-client-0.4.1 | lib/maxcube/messages/tcp/type/z.rb |
maxcube-client-0.4.0 | lib/maxcube/messages/tcp/type/z.rb |