Class: RBus::Message::Base

Inherits:
Object
  • Object
show all
Includes:
Flags, HeaderFields, MessageTypes
Defined in:
lib/rbus/message/message.rb

Overview

Base implementation for the different message types.

Direct Known Subclasses

Error, RBus::MethodCall, RBus::MethodReturn, Signal

Constant Summary

Constants included from Flags

Flags::EMPTY, Flags::NO_AUTO_START, Flags::NO_REPLY_EXPECTED

Constants included from HeaderFields

HeaderFields::DESTINATION, HeaderFields::ERROR_NAME, HeaderFields::INTERFACE, HeaderFields::MEMBER, HeaderFields::PATH, HeaderFields::REPLY_SERIAL, HeaderFields::SENDER, HeaderFields::SIGNATURE

Constants included from MessageTypes

MessageTypes::ERROR, MessageTypes::INVALID, MessageTypes::METHOD_CALL, MessageTypes::METHOD_RETURN, MessageTypes::SIGNAL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Base

Returns a new instance of Base.

Yields:

  • (_self)

Yield Parameters:



45
46
47
48
49
50
51
# File 'lib/rbus/message/message.rb', line 45

def initialize
  @flags ||= EMPTY
  @body = ''
  @serial = SerialGenerator.get_unique
  @type ||= INVALID
  yield self if block_given?
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



38
39
40
# File 'lib/rbus/message/message.rb', line 38

def arguments
  @arguments
end

#bodyObject

Returns the value of attribute body.



40
41
42
# File 'lib/rbus/message/message.rb', line 40

def body
  @body
end

#destinationObject

Returns the value of attribute destination.



35
36
37
# File 'lib/rbus/message/message.rb', line 35

def destination
  @destination
end

#flagsObject

Returns the value of attribute flags.



40
41
42
# File 'lib/rbus/message/message.rb', line 40

def flags
  @flags
end

#interfaceObject

Returns the value of attribute interface.



35
36
37
# File 'lib/rbus/message/message.rb', line 35

def interface
  @interface
end

#memberObject

Returns the value of attribute member.



36
37
38
# File 'lib/rbus/message/message.rb', line 36

def member
  @member
end

#object_pathObject

Returns the value of attribute object_path.



36
37
38
# File 'lib/rbus/message/message.rb', line 36

def object_path
  @object_path
end

#senderObject

Returns the value of attribute sender.



37
38
39
# File 'lib/rbus/message/message.rb', line 37

def sender
  @sender
end

#serialObject

Returns the value of attribute serial.



43
44
45
# File 'lib/rbus/message/message.rb', line 43

def serial
  @serial
end

#signatureObject

Returns the value of attribute signature.



38
39
40
# File 'lib/rbus/message/message.rb', line 38

def signature
  @signature
end

#typeObject

Returns the value of attribute type.



42
43
44
# File 'lib/rbus/message/message.rb', line 42

def type
  @type
end

Instance Method Details

#header_fieldsObject



70
71
72
73
74
75
76
77
78
# File 'lib/rbus/message/message.rb', line 70

def header_fields
  hf = []
  @object_path and hf << [PATH,         Variant.new(@object_path, 'o')]
  @interface   and hf << [INTERFACE,    Variant.new(@interface, 's')]
  @member      and hf << [MEMBER,       Variant.new(@member, 's')]
  @destination and hf << [DESTINATION,  Variant.new(@destination, 's')]
  @signature   and hf << [SIGNATURE,    Variant.new(@signature, 'g')]
  hf
end

#no_auto_start=(bool) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/rbus/message/message.rb', line 62

def no_auto_start=(bool)
  if bool
    @flags |= NO_AUTO_START
  else
    @flags &= ~ NO_AUTO_START
  end
end

#no_reply=(bool) ⇒ Object



53
54
55
56
57
58
59
60
# File 'lib/rbus/message/message.rb', line 53

def no_reply=(bool)
  if bool
    @flags |= NO_REPLY_EXPECTED
  else
    @flags &= ~ NO_REPLY_EXPECTED
  end
  puts "FLAGS: #{@flags}"
end