diff options
Diffstat (limited to 'src/components/dbus/include/dbus')
-rw-r--r-- | src/components/dbus/include/dbus/dbus_adapter.h | 25 | ||||
-rw-r--r-- | src/components/dbus/include/dbus/dbus_message.h | 35 | ||||
-rw-r--r-- | src/components/dbus/include/dbus/dbus_message_inl.h | 6 | ||||
-rw-r--r-- | src/components/dbus/include/dbus/message_descriptions.h | 6 | ||||
-rw-r--r-- | src/components/dbus/include/dbus/schema.h | 2 |
5 files changed, 40 insertions, 34 deletions
diff --git a/src/components/dbus/include/dbus/dbus_adapter.h b/src/components/dbus/include/dbus/dbus_adapter.h index ec59fa421e..3877649e10 100644 --- a/src/components/dbus/include/dbus/dbus_adapter.h +++ b/src/components/dbus/include/dbus/dbus_adapter.h @@ -85,7 +85,9 @@ class DBusAdapter { * \param name pair interface and name of method for call * \param obj params for call */ - void MethodCall(uint id, const MessageId func_id, const MessageName& name, + void MethodCall(uint id, + const MessageId func_id, + const MessageName& name, const smart_objects::SmartObject& obj); /** @@ -95,7 +97,8 @@ class DBusAdapter { * \param name pair interface and name of signal for call * \param obj params for signal */ - void Signal(const MessageId func_id, const MessageName& name, + void Signal(const MessageId func_id, + const MessageName& name, const smart_objects::SmartObject& obj); /** @@ -103,7 +106,9 @@ class DBusAdapter { * \param id id message * \param obj params for return */ - void MethodReturn(uint id, const MessageId func_id, const MessageName& name, + void MethodReturn(uint id, + const MessageId func_id, + const MessageName& name, const smart_objects::SmartObject& obj); /** @@ -219,7 +224,8 @@ class DBusAdapter { * \param args map of arguments * \return true if success */ - bool SetArguments(DBusMessage* msg, const ListArgs& rules, + bool SetArguments(DBusMessage* msg, + const ListArgs& rules, const smart_objects::SmartObject& args); /** @@ -278,7 +284,7 @@ class DBusAdapter { bool SetOptionalValue( DBusMessageIter* iter, const ford_message_descriptions::ParameterDescription* rules, - const smart_objects::SmartObject ¶m); + const smart_objects::SmartObject& param); /** * \brief gets arguments from message @@ -287,7 +293,7 @@ class DBusAdapter { * \param message response message (output) * \return true if success */ - bool GetHeader(DBusMessageIter* iter, int *code, std::string *message); + bool GetHeader(DBusMessageIter* iter, int* code, std::string* message); /** * \brief gets arguments from message with header @@ -296,7 +302,8 @@ class DBusAdapter { * \param args map of arguments * \return true if success */ - bool GetArguments(DBusMessageIter* iter, const ListArgs& rules, + bool GetArguments(DBusMessageIter* iter, + const ListArgs& rules, smart_objects::SmartObject& args); /** @@ -309,7 +316,7 @@ class DBusAdapter { bool GetOneArgument( DBusMessageIter* iter, const ford_message_descriptions::ParameterDescription* rules, - smart_objects::SmartObject &args); + smart_objects::SmartObject& args); /** * \brief gets value for argument @@ -355,7 +362,7 @@ class DBusAdapter { bool GetOptionalValue( DBusMessageIter* iter, const ford_message_descriptions::ParameterDescription* rules, - smart_objects::SmartObject ¶m); + smart_objects::SmartObject& param); /** * \brief processes request on introspect diff --git a/src/components/dbus/include/dbus/dbus_message.h b/src/components/dbus/include/dbus/dbus_message.h index 42ec68b3bf..10f419f445 100644 --- a/src/components/dbus/include/dbus/dbus_message.h +++ b/src/components/dbus/include/dbus/dbus_message.h @@ -46,7 +46,7 @@ enum ContainerType { }; class MessageRefKeeper { -public: + public: MessageRefKeeper(); MessageRefKeeper(DBusMessage* message); ~MessageRefKeeper(); @@ -55,7 +55,8 @@ public: DBusMessage* get() const; DBusMessage* Pass(); void swap(MessageRefKeeper& other); -private: + + private: DBusMessage* raw_message_; }; @@ -65,6 +66,7 @@ class MessageRef { ~MessageRef(); std::string GetInterface() const; std::string GetMember() const; + protected: MessageRefKeeper raw_message_ref_; friend class MessageReader; @@ -96,29 +98,30 @@ class MessageReader { bool NextIsDictEntry() const; // Readers - bool TakeBool(); - uint8_t TakeByte(); - int16_t TakeInt16(); + bool TakeBool(); + uint8_t TakeByte(); + int16_t TakeInt16(); uint16_t TakeUint16(); - int32_t TakeInt32(); + int32_t TakeInt32(); uint32_t TakeUint32(); - int64_t TakeInt64(); + int64_t TakeInt64(); uint64_t TakeUint64(); - double TakeDouble(); + double TakeDouble(); std::string TakeString(); MessageReader TakeArrayReader(); MessageReader TakeStructReader(); MessageReader TakeDictEntryReader(); + private: typedef int DataType; // Container reader constructor - MessageReader(MessageReader* reader, - DataType container_data_type); + MessageReader(MessageReader* reader, DataType container_data_type); void MoveToNext(); void MarkFailed(); DataType NextValueType() const; void ReadNextValue(DataType type, void* value); + private: // Fields MessageReader* parent_reader_; @@ -146,13 +149,15 @@ class MessageWriter { void PutUint64(uint64_t value); void PutDouble(double value); void PutString(const std::string& value); + private: typedef int DataType; // Main constructor void WriteAndCheck(DataType value_type, const void* value); void CloseWriter(); + private: - //Fields + // Fields bool has_opened_subcontainer_; MessageWriter* parent_writer_; DBusMessageIter iterator_; @@ -166,11 +171,9 @@ MessageRef MethodCall(const char* bus_name, const char* path, const char* interface, const char* method); -MessageRef Signal(const char *path, - const char *interface, - const char *name); -} // namespace dbus +MessageRef Signal(const char* path, const char* interface, const char* name); +} // namespace dbus #include "dbus/dbus_message_inl.h" -#endif // DBUS_DBUS_MESSAGE_H +#endif // DBUS_DBUS_MESSAGE_H diff --git a/src/components/dbus/include/dbus/dbus_message_inl.h b/src/components/dbus/include/dbus/dbus_message_inl.h index 714e66ea33..1a10f828de 100644 --- a/src/components/dbus/include/dbus/dbus_message_inl.h +++ b/src/components/dbus/include/dbus/dbus_message_inl.h @@ -161,14 +161,11 @@ inline std::string MessageReader::TakeString() { return value; } - inline MessageReader::DataType MessageReader::NextValueType() const { DBusMessageIter* iter = const_cast<DBusMessageIter*>(&iterator_); return failed_ ? DBUS_TYPE_INVALID : dbus_message_iter_get_arg_type(iter); } - - // Message writer methods inline void MessageWriter::PutBool(bool value) { dbus_bool_t dbus_value = value; @@ -212,7 +209,6 @@ inline void MessageWriter::PutString(const std::string& value) { WriteAndCheck(DBUS_TYPE_STRING, &pointer); } - } // namespace dbus -#endif // DBUS_MESSAGE_INL_H +#endif // DBUS_MESSAGE_INL_H diff --git a/src/components/dbus/include/dbus/message_descriptions.h b/src/components/dbus/include/dbus/message_descriptions.h index 18c27ce0d6..a9e7a5e141 100644 --- a/src/components/dbus/include/dbus/message_descriptions.h +++ b/src/components/dbus/include/dbus/message_descriptions.h @@ -38,12 +38,13 @@ namespace ford_message_descriptions { -enum ParameterType {Integer, Boolean, Float, String, Struct, Enum, Array}; +enum ParameterType { Integer, Boolean, Float, String, Struct, Enum, Array }; struct ParameterDescription { const char* name; const ParameterType type; - const bool obligatory; // TODO (dchmerev@luxoft.com): rename to 'mandatory' as in HMI API description + const bool obligatory; // TODO (dchmerev@luxoft.com): rename to 'mandatory' + // as in HMI API description }; struct ArrayDescription { @@ -70,4 +71,3 @@ extern const MessageDescription* message_descriptions[]; } // namespace ford_message_descriptions #endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_MESSAGE_DESCRIPTIONS_H_ - diff --git a/src/components/dbus/include/dbus/schema.h b/src/components/dbus/include/dbus/schema.h index 2a5f6f3615..e269bd2596 100644 --- a/src/components/dbus/include/dbus/schema.h +++ b/src/components/dbus/include/dbus/schema.h @@ -48,7 +48,7 @@ struct Description; typedef hmi_apis::FunctionID::eType MessageId; typedef hmi_apis::messageType::eType MessageType; -typedef std::pair<std::string, std::string> MessageName; // interface, message +typedef std::pair<std::string, std::string> MessageName; // interface, message typedef std::vector<const ParameterDescription*> ListArgs; typedef std::vector<const Description*> Messages; |