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.



1719
1720
1721
1722
1723
1724
1725
1726
1727
# File 'lib/mdk_protocol.rb', line 1719

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.



1712
1713
1714
# File 'lib/mdk_protocol.rb', line 1712

def json_type
  @json_type
end

#payloadObject

Returns the value of attribute payload.



1712
1713
1714
# File 'lib/mdk_protocol.rb', line 1712

def payload
  @payload
end

#sequenceObject

Returns the value of attribute sequence.



1712
1713
1714
# File 'lib/mdk_protocol.rb', line 1712

def sequence
  @sequence
end

#syncObject

Returns the value of attribute sync.



1712
1713
1714
# File 'lib/mdk_protocol.rb', line 1712

def sync
  @sync
end

Instance Method Details

#__init_fields__Object



1796
1797
1798
1799
1800
1801
1802
1803
1804
# File 'lib/mdk_protocol.rb', line 1796

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

    nil
end

#_getClassObject



1752
1753
1754
1755
1756
1757
# File 'lib/mdk_protocol.rb', line 1752

def _getClass()
    
    return "mdk_protocol.AckableEvent"

    nil
end

#_getField(name) ⇒ Object



1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
# File 'lib/mdk_protocol.rb', line 1759

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



1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
# File 'lib/mdk_protocol.rb', line 1778

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



1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
# File 'lib/mdk_protocol.rb', line 1739

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



1732
1733
1734
1735
1736
1737
# File 'lib/mdk_protocol.rb', line 1732

def getTimestamp()
    
    return @payload.getTimestamp()

    nil
end