Class: Quark::MdkProtocol::AckableEvent

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_protocol.rb

Overview

An event that can be acknowledged.

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(json_type, payload, sequence) ⇒ AckableEvent

Returns a new instance of AckableEvent.



1727
1728
1729
1730
1731
1732
1733
1734
1735
# File 'lib/mdk_protocol.rb', line 1727

def initialize(json_type, payload, sequence)
    
    self.__init_fields__
    (self).json_type = json_type
    (self).payload = payload
    (self).sequence = sequence

    nil
end

Instance Attribute Details

#json_typeObject

Returns the value of attribute json_type.



1720
1721
1722
# File 'lib/mdk_protocol.rb', line 1720

def json_type
  @json_type
end

#payloadObject

Returns the value of attribute payload.



1720
1721
1722
# File 'lib/mdk_protocol.rb', line 1720

def payload
  @payload
end

#sequenceObject

Returns the value of attribute sequence.



1720
1721
1722
# File 'lib/mdk_protocol.rb', line 1720

def sequence
  @sequence
end

#syncObject

Returns the value of attribute sync.



1720
1721
1722
# File 'lib/mdk_protocol.rb', line 1720

def sync
  @sync
end

Instance Method Details

#__init_fields__Object



1804
1805
1806
1807
1808
1809
1810
1811
1812
# File 'lib/mdk_protocol.rb', line 1804

def __init_fields__()
    
    self.json_type = nil
    self.sequence = nil
    self.sync = 1
    self.payload = nil

    nil
end

#_getClassObject



1760
1761
1762
1763
1764
1765
# File 'lib/mdk_protocol.rb', line 1760

def _getClass()
    
    return "mdk_protocol.AckableEvent"

    nil
end

#_getField(name) ⇒ Object



1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
# File 'lib/mdk_protocol.rb', line 1767

def _getField(name)
    
    if ((name) == ("json_type"))
        return (self).json_type
    end
    if ((name) == ("sequence"))
        return (self).sequence
    end
    if ((name) == ("sync"))
        return (self).sync
    end
    if ((name) == ("payload"))
        return (self).payload
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
# File 'lib/mdk_protocol.rb', line 1786

def _setField(name, value)
    
    if ((name) == ("json_type"))
        (self).json_type = ::DatawireQuarkCore.cast(value) { ::String }
    end
    if ((name) == ("sequence"))
        (self).sequence = ::DatawireQuarkCore.cast(value) { ::Integer }
    end
    if ((name) == ("sync"))
        (self).sync = ::DatawireQuarkCore.cast(value) { ::Integer }
    end
    if ((name) == ("payload"))
        (self).payload = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_protocol.AckablePayload }
    end

    nil
end

#encodeObject



1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
# File 'lib/mdk_protocol.rb', line 1747

def encode()
    
    clazz = ::Quark.quark.reflect.QuarkClass.get(::DatawireQuarkCore._getClass((self).payload))
    json = ::Quark.quark.toJSON((self).payload, clazz)
    (json).setObjectItem(("type"), (::DatawireQuarkCore::JSONObject.new.setString((self).json_type)))
    (json).setObjectItem(("sequence"), (::DatawireQuarkCore::JSONObject.new.setNumber((self).sequence)))
    (json).setObjectItem(("sync"), (::DatawireQuarkCore::JSONObject.new.setNumber((self).sync)))
    encoded = json.toString()
    return encoded

    nil
end

#getTimestampObject



1740
1741
1742
1743
1744
1745
# File 'lib/mdk_protocol.rb', line 1740

def getTimestamp()
    
    return @payload.getTimestamp()

    nil
end