diff options
author | <philippe colliot> | 2015-06-30 17:14:02 +0200 |
---|---|---|
committer | <philippe colliot> | 2015-06-30 17:14:02 +0200 |
commit | 2767d87ea7b9858a285f0c106262891d834422de (patch) | |
tree | 6c3cae3e1ad0138ada8367e4e854c19116a2e2e1 | |
parent | 3918e22c468ff58cc239da310689f951a7d0ce57 (diff) | |
download | poi-service-2767d87ea7b9858a285f0c106262891d834422de.tar.gz |
poi-manager-client under test, create/remove category OK
26 files changed, 2879 insertions, 405 deletions
@@ -3,18 +3,15 @@ *-Debug/ *-release/ *-Release/ -bin/ -lib/ -positioning/ -build/ +bin +lib +build + #files *~ -*.pro.user +*.pro.user* *.txt.user* /.project -CMakeFiles/ -CMakeCache.txt -cmake_install.cmake diff --git a/api/.gitignore b/api/.gitignore index 9d6e68e..65a2c4a 100644 --- a/api/.gitignore +++ b/api/.gitignore @@ -1,5 +1,6 @@ #folder used for downloading external APIs .project +.classpath CMakeCache.txt cmake_install.cmake Makefile diff --git a/api/franca/navigation/poiservice/POIServiceTypes.fidl b/api/franca/navigation/poiservice/POIServiceTypes.fidl index fdcf3a4..46a297f 100755 --- a/api/franca/navigation/poiservice/POIServiceTypes.fidl +++ b/api/franca/navigation/poiservice/POIServiceTypes.fidl @@ -78,21 +78,7 @@ typeCollection POIServiceTypes { String stringValue
Boolean boolValue
}
-
- struct AttributeValueStruct polymorphic {}
-
- struct AttributeValueStructInt32 extends AttributeValueStruct {
- Int32 intValue
- }
-
- struct AttributeValueStructString extends AttributeValueStruct {
- String stringValue
- }
-
- struct AttributeValueStructBoolean extends AttributeValueStruct {
- Boolean boolValue
- }
-
+
<** @description:**>
struct Details {
<** @description : list of parent categories unique id.**>
@@ -333,7 +319,7 @@ typeCollection POIServiceTypes { String name
<** @description:POI location.**>
Coordinate3D location
- <** @description: array[struct(name,type,value)].**>
+ <** @description: array[struct(id,type,value)].**>
PoiAttribute[] attributes
}
diff --git a/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.cpp b/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.cpp index 3c7bc3c..021a56e 100644 --- a/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.cpp +++ b/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.cpp @@ -28,172 +28,6 @@ namespace POIServiceTypes { - -AttributeValueStruct* AttributeValueStruct::createInstance(const uint32_t& serialId) { - if (serialId == SERIAL_ID) - return new AttributeValueStruct; - - const std::function<AttributeValueStruct*()> createDerivedInstanceFuncs[] = { - [&]() { return AttributeValueStructInt32::createInstance(serialId); }, - [&]() { return AttributeValueStructString::createInstance(serialId); }, - [&]() { return AttributeValueStructBoolean::createInstance(serialId); } - }; - - for (auto& createDerivedInstanceFunc : createDerivedInstanceFuncs) { - AttributeValueStruct* derivedInstance = createDerivedInstanceFunc(); - if (derivedInstance != NULL) - return derivedInstance; - } - - return NULL; -} - -uint32_t AttributeValueStruct::getSerialId() const { - return SERIAL_ID; -} - -void AttributeValueStruct::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const { - AttributeValueStruct::writeToTypeOutputStream(typeOutputStream); -} - -bool operator==(const AttributeValueStruct& lhs, const AttributeValueStruct& rhs) { - if (&lhs == &rhs) - return true; - - return - true - ; -} - -void AttributeValueStruct::readFromInputStream(CommonAPI::InputStream& inputStream) { -} - -void AttributeValueStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { -} - -AttributeValueStructInt32::AttributeValueStructInt32(const int32_t& intValueValue): - AttributeValueStruct(), - intValue(intValueValue) -{ -} - -AttributeValueStructInt32* AttributeValueStructInt32::createInstance(const uint32_t& serialId) { - if (serialId == SERIAL_ID) - return new AttributeValueStructInt32; - - return NULL; -} - -uint32_t AttributeValueStructInt32::getSerialId() const { - return SERIAL_ID; -} - -void AttributeValueStructInt32::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const { - AttributeValueStructInt32::writeToTypeOutputStream(typeOutputStream); -} - -bool operator==(const AttributeValueStructInt32& lhs, const AttributeValueStructInt32& rhs) { - if (&lhs == &rhs) - return true; - - return - static_cast<AttributeValueStructInt32::AttributeValueStruct>(lhs) == static_cast<AttributeValueStructInt32::AttributeValueStruct>(rhs) && - lhs.intValue == rhs.intValue - ; -} - -void AttributeValueStructInt32::readFromInputStream(CommonAPI::InputStream& inputStream) { - AttributeValueStruct::readFromInputStream(inputStream); - inputStream >> intValue; -} - -void AttributeValueStructInt32::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { - AttributeValueStruct::writeToOutputStream(outputStream); - outputStream << intValue; -} - -AttributeValueStructString::AttributeValueStructString(const std::string& stringValueValue): - AttributeValueStruct(), - stringValue(stringValueValue) -{ -} - -AttributeValueStructString* AttributeValueStructString::createInstance(const uint32_t& serialId) { - if (serialId == SERIAL_ID) - return new AttributeValueStructString; - - return NULL; -} - -uint32_t AttributeValueStructString::getSerialId() const { - return SERIAL_ID; -} - -void AttributeValueStructString::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const { - AttributeValueStructString::writeToTypeOutputStream(typeOutputStream); -} - -bool operator==(const AttributeValueStructString& lhs, const AttributeValueStructString& rhs) { - if (&lhs == &rhs) - return true; - - return - static_cast<AttributeValueStructString::AttributeValueStruct>(lhs) == static_cast<AttributeValueStructString::AttributeValueStruct>(rhs) && - lhs.stringValue == rhs.stringValue - ; -} - -void AttributeValueStructString::readFromInputStream(CommonAPI::InputStream& inputStream) { - AttributeValueStruct::readFromInputStream(inputStream); - inputStream >> stringValue; -} - -void AttributeValueStructString::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { - AttributeValueStruct::writeToOutputStream(outputStream); - outputStream << stringValue; -} - -AttributeValueStructBoolean::AttributeValueStructBoolean(const bool& boolValueValue): - AttributeValueStruct(), - boolValue(boolValueValue) -{ -} - -AttributeValueStructBoolean* AttributeValueStructBoolean::createInstance(const uint32_t& serialId) { - if (serialId == SERIAL_ID) - return new AttributeValueStructBoolean; - - return NULL; -} - -uint32_t AttributeValueStructBoolean::getSerialId() const { - return SERIAL_ID; -} - -void AttributeValueStructBoolean::createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const { - AttributeValueStructBoolean::writeToTypeOutputStream(typeOutputStream); -} - -bool operator==(const AttributeValueStructBoolean& lhs, const AttributeValueStructBoolean& rhs) { - if (&lhs == &rhs) - return true; - - return - static_cast<AttributeValueStructBoolean::AttributeValueStruct>(lhs) == static_cast<AttributeValueStructBoolean::AttributeValueStruct>(rhs) && - lhs.boolValue == rhs.boolValue - ; -} - -void AttributeValueStructBoolean::readFromInputStream(CommonAPI::InputStream& inputStream) { - AttributeValueStruct::readFromInputStream(inputStream); - inputStream >> boolValue; -} - -void AttributeValueStructBoolean::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { - AttributeValueStruct::writeToOutputStream(outputStream); - outputStream << boolValue; -} - Details::Details(const std::vector<CategoryID>& parentsIdValue, const Icon& iconsValue, const std::string& nameValue, const std::string& shortDescValue, const Media& mediaValue): parentsId(parentsIdValue), icons(iconsValue), diff --git a/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.h b/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.h index 479e6c7..f658ba7 100644 --- a/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.h +++ b/api/franca/navigation/src-gen/org/genivi/navigation/poiservice/POIServiceTypes.h @@ -125,86 +125,6 @@ namespace POIServiceTypes { * values for attribute. */ typedef CommonAPI::Variant<int32_t, std::string, bool> AttributeValue; - struct AttributeValueStruct: CommonAPI::SerializablePolymorphicStruct { - - AttributeValueStruct() = default; - - enum: uint32_t { SERIAL_ID = 0x1d47fc57 }; - - static AttributeValueStruct* createInstance(const uint32_t& serialId); - - virtual uint32_t getSerialId() const; - virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const; - - virtual void readFromInputStream(CommonAPI::InputStream& inputStream); - virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; - - static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - } - }; - struct AttributeValueStructInt32: AttributeValueStruct { - int32_t intValue; - - AttributeValueStructInt32() = default; - AttributeValueStructInt32(const int32_t& intValue); - - enum: uint32_t { SERIAL_ID = 0xebabbc39 }; - - static AttributeValueStructInt32* createInstance(const uint32_t& serialId); - - virtual uint32_t getSerialId() const; - virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const; - - virtual void readFromInputStream(CommonAPI::InputStream& inputStream); - virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; - - static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - AttributeValueStruct::writeToTypeOutputStream(typeOutputStream); - typeOutputStream.writeInt32Type(); - } - }; - struct AttributeValueStructString: AttributeValueStruct { - std::string stringValue; - - AttributeValueStructString() = default; - AttributeValueStructString(const std::string& stringValue); - - enum: uint32_t { SERIAL_ID = 0x84441672 }; - - static AttributeValueStructString* createInstance(const uint32_t& serialId); - - virtual uint32_t getSerialId() const; - virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const; - - virtual void readFromInputStream(CommonAPI::InputStream& inputStream); - virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; - - static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - AttributeValueStruct::writeToTypeOutputStream(typeOutputStream); - typeOutputStream.writeStringType(); - } - }; - struct AttributeValueStructBoolean: AttributeValueStruct { - bool boolValue; - - AttributeValueStructBoolean() = default; - AttributeValueStructBoolean(const bool& boolValue); - - enum: uint32_t { SERIAL_ID = 0xa6ee8ff6 }; - - static AttributeValueStructBoolean* createInstance(const uint32_t& serialId); - - virtual uint32_t getSerialId() const; - virtual void createTypeSignature(CommonAPI::TypeOutputStream& typeOutputStream) const; - - virtual void readFromInputStream(CommonAPI::InputStream& inputStream); - virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; - - static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - AttributeValueStruct::writeToTypeOutputStream(typeOutputStream); - typeOutputStream.writeBoolType(); - } - }; /** * */ @@ -977,7 +897,7 @@ namespace POIServiceTypes { */ NavigationTypes::Coordinate3D location; /** - * array[struct(name,type,value)]. + * array[struct(id,type,value)]. */ std::vector<PoiAttribute> attributes; @@ -1085,22 +1005,6 @@ struct UpdateReasonComparator { } }; -bool operator==(const AttributeValueStruct& lhs, const AttributeValueStruct& rhs); -inline bool operator!=(const AttributeValueStruct& lhs, const AttributeValueStruct& rhs) { - return !(lhs == rhs); -} -bool operator==(const AttributeValueStructInt32& lhs, const AttributeValueStructInt32& rhs); -inline bool operator!=(const AttributeValueStructInt32& lhs, const AttributeValueStructInt32& rhs) { - return !(lhs == rhs); -} -bool operator==(const AttributeValueStructString& lhs, const AttributeValueStructString& rhs); -inline bool operator!=(const AttributeValueStructString& lhs, const AttributeValueStructString& rhs) { - return !(lhs == rhs); -} -bool operator==(const AttributeValueStructBoolean& lhs, const AttributeValueStructBoolean& rhs); -inline bool operator!=(const AttributeValueStructBoolean& lhs, const AttributeValueStructBoolean& rhs) { - return !(lhs == rhs); -} bool operator==(const Details& lhs, const Details& rhs); inline bool operator!=(const Details& lhs, const Details& rhs) { return !(lhs == rhs); diff --git a/api/poi-service/CMakeLists.txt b/api/poi-service/CMakeLists.txt index 12c93e8..af9e7f0 100644 --- a/api/poi-service/CMakeLists.txt +++ b/api/poi-service/CMakeLists.txt @@ -25,6 +25,7 @@ find_program(DBUSXML2CPP dbusxx-xml2cpp REQUIRED) file (GLOB XML_TO_DBUS ${CMAKE_CURRENT_SOURCE_DIR}/genivi-poiservice-contentaccessmodule.xml + ${CMAKE_CURRENT_SOURCE_DIR}/genivi-poiservice-contentmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/genivi-poiservice-poicontentaccess.xml ${CMAKE_CURRENT_SOURCE_DIR}/genivi-poiservice-poisearch.xml ${CMAKE_CURRENT_SOURCE_DIR}/genivi-poiservice-configuration.xml diff --git a/api/poi-service/genivi-poiservice-contentmanager.xml b/api/poi-service/genivi-poiservice-contentmanager.xml new file mode 100644 index 0000000..1fbda33 --- /dev/null +++ b/api/poi-service/genivi-poiservice-contentmanager.xml @@ -0,0 +1,368 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="introspect.xsl"?> +<node xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="introspect.xsd" name="org.genivi.navigation.poiservice"> + <interface name="org.genivi.poiservice.POIContentManager"> + <version>1.0</version> + <method name="getVersion"> + <doc> + <line>getVersion = This method returns the API version implemented by the content access module.</line> + </doc> + <arg direction="out" name="version" type="(qqqs)"> + <doc> + <line>version (of type Version) = .</line> + <line>Version struct[versionMajor, versionMinor, versionMicro, date] = version.</line> + <line>Version.versionMajor ('q') = when the major changes, then backward compatibility with previous releases is not granted.</line> + <line>Version.versionMinor ('q') = when the minor changes, then backward compatibility with previous releases is granted, but something changed in the implementation of the API (e.g. new methods may have been added).</line> + <line>Version.versionMicro ('q') = when the micro changes, then backward compatibility with previous releases is granted (bug fixes or documentation modifications).</line> + <line>Version.date ('s') = release date (e.g. 21-06-2011).</line> + </doc> + </arg> + </method> + <method name="setLocale"> + <doc> + <line>setLocale = Set the current language set for the search by poi provider module.</line> + <line>The language defines the poi and categories name and details language. If the language is not supported, the default details will be returned in the native language.</line> + </doc> + <arg direction="in" name="languageCode" type="s"> + <doc> + <line>languageCode = the language to be used. ISO 639‐3 language code (lower case)</line> + </doc> + </arg> + <arg direction="in" name="countryCode" type="s"> + <doc> + <line>countryCode = the country specific variant for the language to be used. ISO 3166‐1 alpha 3 country code (upper case)</line> + </doc> + </arg> + <arg direction="in" name="scriptCode" type="s"> + <doc> + <line>scriptCode = the script specific variant for the language to be used. ISO 15924 alpha 4 script code (upper case)</line> + </doc> + </arg> + </method> + <method name="getLocale"> + <doc> + <line>getLocale = Get the current language set for the search by poi provider module.</line> + </doc> + <arg direction="out" name="languageCode" type="s"> + <doc> + <line>languageCode = the language used. ISO 639‐3 language code (lower case)</line> + </doc> + </arg> + <arg direction="out" name="countryCode" type="s"> + <doc> + <line>countryCode = the country specific variant for the language used. ISO 3166‐1 alpha 3 country code (upper case)</line> + </doc> + </arg> + <arg direction="out" name="scriptCode" type="s"> + <doc> + <line>scriptCode = the script specific variant for the language used. ISO 15924 alpha 4 script code (upper case)</line> + </doc> + </arg> + </method> + <method name="getSupportedLocales"> + <doc> + <line>getSupportedLocales = Get the supported set of locales for the search by poi provider module.</line> + </doc> + <arg direction="out" name="localeList" type="a(sss)"> + <doc> + <line>localeList = array[struct(languageCode,countryCode,scriptCode)]</line> + </doc> + </arg> + </method> + <method name="getAvailableCategories"> + <doc> + <line>getAvailableCategories = This method retrieves the list od POI categories available (pre-defined and custom).</line> + </doc> + <arg direction="out" name="categories" type="a(usb)"> + <doc> + <line>categories (of type CategoryAndName) = List of categories (id, name and top_level).</line> + <line>CategoryAndName struct[uniqueId, name, topLevel] = pair of category and name</line> + <line>CategoryAndName.uniqueId ('?') = Category unique id.</line> + <line>CategoryAndName.name ('s') = name.</line> + <line>CategoryAndName.topLevel ('b') = true if the category is a pre-defined one (top level), false for customized categories created by plug-in.</line> + </doc> + </arg> + </method> + <method name="getRootCategory"> + <doc> + <line>getRootCategory = Get the root category id. That would be ALL_CATEGORIES.</line> + </doc> + <arg direction="out" name="category" type="u"> + <doc> + <line>category (of type CategoryID) = The root category is a top level one by design.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </method> + <method name="getChildrenCategories"> + <doc> + <line>getChildrenCategories = Get the children categories id and type (top level) from the a parent unique id.</line> + </doc> + <arg direction="in" name="category" type="u"> + <doc> + <line>category (of type CategoryID) = unique category id.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + <arg direction="out" name="categories" type="a(ub)"> + <doc> + <line>categories (of type CategoryAndLevel) = List of categories (id and top_level).</line> + <line>CategoryAndLevel struct[uniqueId, topLevel] = Pair of catgory and description of level</line> + <line>CategoryAndLevel.uniqueId ('?') = Category unique id.</line> + <line>CategoryAndLevel.topLevel ('b') = true if the category is a pre-defined one (top level), false for customized categories created by plug-in.</line> + </doc> + </arg> + </method> + <method name="getParentCategories"> + <doc> + <line>getParentCategories = Get the parent categories id and type (top level) from the a unique id.</line> + </doc> + <arg direction="in" name="category" type="u"> + <doc> + <line>category (of type CategoryID) = unique category id.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + <arg direction="out" name="categories" type="a(ub)"> + <doc> + <line>categories (of type CategoryAndLevel) = List of categories (id and top_level).</line> + <line>CategoryAndLevel struct[uniqueId, topLevel] = Pair of catgory and description of level</line> + <line>CategoryAndLevel.uniqueId ('?') = Category unique id.</line> + <line>CategoryAndLevel.topLevel ('b') = true if the category is a pre-defined one (top level), false for customized categories created by plug-in.</line> + </doc> + </arg> + </method> + <method name="createCategory"> + <doc> + <line>createCategory = Creates a category by name and return an unique id.</line> + </doc> + <arg direction="in" name="category" type="((au(yv)ss(yv))a(usia(is(yv)))a(us))"> + <doc> + <line>category (of type CAMCategory) = List of details for the category to create.</line> + <line>CAMCategory struct[details, attributes, sortOptions] = </line> + <line>CAMCategory.details ('?') = struct(list of parents_id, icons, name, short_desc, media).</line> + <line>CAMCategory.attributes ('?') = array[struct(name, type, array[struct(operator_id, operator_name)])].</line> + <line>CAMCategory.sortOptions ('?') = array[struct(id, name)].</line> + </doc> + </arg> + <arg direction="out" name="unique_id" type="u"> + <doc> + <line>unique_id (of type CategoryID) = Category unique id.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </method> + <method name="removeCategories"> + <doc> + <line>removeCategories = Removes a list of categories. Because of required time to remove it from the database, a signal is emitted when the deletion is done.</line> + </doc> + <arg direction="in" name="categories" type="au"> + <doc> + <line>categories (of type CategoryID) = List of categories to be removed.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </method> + <method name="addPOIs"> + <doc> + <line>addPOIs = Adds a list of POIs to a category. Because of required time to add it to the database, a signal is emitted when the update is done, that gives the id of the elements added</line> + </doc> + <arg direction="in" name="unique_id" type="u"> + <doc> + <line>unique_id (of type CategoryID) = Category unique id.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + <arg direction="in" name="poiList" type="a(s(ddi)a(ui(yv)))"> + <doc> + <line>poiList (of type PoiAddedDetails) = List of POIs and all their content. Note that there's no id sent, because it's up to the component to give it</line> + <line>PoiAddedDetails struct[name, location, attributes] = </line> + <line>PoiAddedDetails.name ('s') = POI name</line> + <line>PoiAddedDetails.location ('?') = POI location.</line> + <line>PoiAddedDetails.attributes ('?') = array[struct(id,type,value)].</line> + </doc> + </arg> + </method> + <method name="removePOIs"> + <doc> + <line>removePOIs = Removes a list of POIs to a category. Because of required time to remove it from the database, a signal is emitted when the update is done.</line> + </doc> + <arg direction="in" name="ids" type="au"> + <doc> + <line>ids (of type POI_ID) = List of unique ids of POIs to remove.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </method> + <method name="poiSearchStarted"> + <doc> + <line>poiSearchStarted = This method is sent by the POI service component to inform all the CAM that a new POI search was started.</line> + <line>It provides all the relevant search parameters. Of course the CAM will only be aware of the search if it registers one of the search categories.</line> + </doc> + <arg direction="in" name="poiSearchHandle" type="u"> + <doc> + <line>poiSearchHandle = poi search unique handle. It must be used by the CAM to send the list of results to the component.</line> + </doc> + </arg> + <arg direction="in" name="maxSize" type="q"> + <doc> + <line>maxSize = max size of the results list.</line> + </doc> + </arg> + <arg direction="in" name="location" type="(ddi)"> + <doc> + <line>location = struct(lat,lon,alt).</line> + </doc> + </arg> + <arg direction="in" name="poiCategories" type="a(uu)"> + <doc> + <line>poiCategories (of type CategoryAndRadius) = array[struct(id,radius)].</line> + <line>CategoryAndRadius struct[id, radius] = </line> + <line>CategoryAndRadius.id ('?') = enum(INVALID,ALL_CATEGORIES,AIRPORT,RESTAURANT,HOTEL,GAZ_STATION,CAR_PARK, ...). Note: A POI category is a unique ID. It could be a predefined category or a custom one defined by a POI plug-in</line> + <line>CategoryAndRadius.radius ('u') = activation or search radius around the position (in 10 meters) for the category. If value is 0 (zero), the default radius (defined for a category) is applied.</line> + </doc> + </arg> + <arg direction="in" name="poiAttributes" type="a(uui(yv)ib)"> + <doc> + <line>poiAttributes (of type AttributeDetails) = array[struct(name, poiCategory, type, value, operator, mandatory)].</line> + <line>AttributeDetails struct[id, categoryId, type, value, oper, mandatory] = used in setAttrbutes and CAM startPOISearch</line> + <line>AttributeDetails.id ('?') = id of attribute .</line> + <line>AttributeDetails.categoryId ('?') = enum(INVALID,ALL_CATEGORIES,AIRPORT,RESTAURANT,HOTEL,GAZ_STATION,CAR_PARK, ...). Note: A POI category is a unique ID. It could be a predefined category or a custom one defined by a POI plug-in</line> + <line>AttributeDetails.type ('?') = enum(INVALID,STRING,INTEGER,COORDINATES ...).</line> + <line>AttributeDetails.value ('?') = value or partial value. The value depends on the attribute specifications and type.</line> + <line>AttributeDetails.oper ('?') = enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....).</line> + <line>AttributeDetails.mandatory ('b') = true if the attribute is mandatory for the search and false for optional.</line> + </doc> + </arg> + <arg direction="in" name="inputString" type="s"> + <doc> + <line>inputString = contains the name of the poi that is searched. It could be a partial name or an empty string.</line> + </doc> + </arg> + <arg direction="in" name="sortOption" type="q"> + <doc> + <line>sortOption = enum(SORT_DEFAULT,SORT_BY_DISTANCE,SORT_BY_TIME,ATTRIBUTE_CUSTOM, ... )</line> + <line>If more than one category was defined for this search, the sort criteria should be compliant with all categories.</line> + </doc> + </arg> + </method> + <method name="poiSearchCanceled"> + <doc> + <line>poiSearchCanceled = This method cancels the search for the current id.</line> + </doc> + <arg direction="in" name="poiSearchHandle" type="u"> + <doc> + <line>poiSearchHandle = poi search unique handle.</line> + </doc> + </arg> + </method> + <method name="resultListRequested"> + <doc> + <line>resultListRequested = This method provides the poi results list found by the CAM.</line> + <line>As the POI unique id is managed by the POI component, the CAM only provides the POI name, the category and coordinates as well as all the relevant detailed information.</line> + </doc> + <arg direction="in" name="camId" type="y"> + <doc> + <line>camId = Content access module unique id as known by the POI service component.</line> + </doc> + </arg> + <arg direction="in" name="poiSearchHandle" type="u"> + <doc> + <line>poiSearchHandle = poi search unique handle.</line> + </doc> + </arg> + <arg direction="in" name="attributes" type="au"> + <doc> + <line>attributes = List of attributes id to retrieve. This is optional and the list could be empty.</line> + </doc> + </arg> + <arg direction="out" name="statusValue" type="i"> + <doc> + <line>statusValue (of type SearchStatusState) = enum(INVALID,NOT_STARTED,SEARCHING,FINISHED, ... ).</line> + <line>enum[INVALID (null), NOT_STARTED (null), SEARCHING (null), FINISHED (null)]</line> + </doc> + </arg> + <arg direction="out" name="resultListSize" type="q"> + <doc> + <line>resultListSize = Number of items of the results list.</line> + </doc> + </arg> + <arg direction="out" name="resultList" type="a(usu(ddi)qa(ui(yv)))"> + <doc> + <line>resultList (of type PoiCAMDetails) = array[struct(source_id, name, category, location, distance, attributes)].</line> + <line>PoiCAMDetails struct[sourceId, name, category, location, distance, attributes] = </line> + <line>PoiCAMDetails.sourceId ('?') = POI unique id as known by the content access module. This id will be used by POI service to request POI details.</line> + <line>PoiCAMDetails.name ('s') = POI name.</line> + <line>PoiCAMDetails.category ('?') = POI category unique id.</line> + <line>PoiCAMDetails.location ('?') = POI location.</line> + <line>PoiCAMDetails.distance ('q') = distance in meters to poi from center of the search.</line> + <line>PoiCAMDetails.attributes ('?') = List of attributes requested. It could be empty.</line> + </doc> + </arg> + </method> + <method name="poiDetailsRequested"> + <doc> + <line>poiDetailsRequested = This method retrieves the details associated to one or more POI.</line> + <line>It contains the name, the parent categories, the list of attributes, the icons, ... .</line> + </doc> + <arg direction="in" name="source_id" type="au"> + <doc> + <line>source_id (of type POI_ID) = array[unique_poi_id].</line> + <line>lineComment to be defined</line> + </doc> + </arg> + <arg direction="out" name="results" type="a((us(ddi))aua(ui(yv)))"> + <doc> + <line>results (of type SearchResultDetails) = array[(details, categories, attributes)] .</line> + <line>SearchResultDetails struct[details, categories, attributes] = </line> + <line>SearchResultDetails.details ('?') = struct(id,name,latitude,longitude,altitude).</line> + <line>SearchResultDetails.categories ('?') = array[unique_id].</line> + <line>SearchResultDetails.attributes ('?') = array[struct(name,type,value)].</line> + </doc> + </arg> + </method> + <signal name="ConfigurationChanged"> + <doc> + <line>ConfigurationChanged = guidanceStatusChanged = This signal is sent to the clients when one or more configuration settings changes.</line> + </doc> + <arg direction="out" name="changedSettings" type="aq"> + <doc> + <line>changedSettings = changedSettings array[setting].</line> + </doc> + </arg> + </signal> + <signal name="CategoriesRemoved"> + <doc> + <line>CategoriesRemoved = CategoriesRemoved = This signal is emitted when a list of categories and associated content has been removed from the database.</line> + </doc> + <arg direction="out" name="categories" type="au"> + <doc> + <line>categories (of type CategoryID) = List of categories removed.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </signal> + <signal name="POIAdded"> + <doc> + <line>POIAdded = POIAdded = This signal is emitted when a list of POIs and associated content has been added to the database. It returns the ids.</line> + </doc> + <arg direction="out" name="pois" type="au"> + <doc> + <line>pois (of type POI_ID) = List of unique ids of POIs added. The order is the same as the order in the AddPOIs method.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </signal> + <signal name="POIRemoved"> + <doc> + <line>POIRemoved = POIRemoved = This signal is emitted when a list of POIs and associated content has been removed from the database.</line> + </doc> + <arg direction="out" name="pois" type="au"> + <doc> + <line>pois (of type POI_ID) = List of unique ids of POIs removed.</line> + <line>lineComment to be defined</line> + </doc> + </arg> + </signal> + </interface> +</node> diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index e69de29..0000000 --- a/src/.gitignore +++ /dev/null diff --git a/src/navigation/.gitignore b/src/navigation/.gitignore index 5d83e45..7c0c8b0 100644 --- a/src/navigation/.gitignore +++ b/src/navigation/.gitignore @@ -1,5 +1,3 @@ navit ilm -Makefile -lib -bin +positioning
\ No newline at end of file diff --git a/src/poi-service/.gitignore b/src/poi-service/.gitignore index 04b5943..300d260 100644 --- a/src/poi-service/.gitignore +++ b/src/poi-service/.gitignore @@ -1,9 +1,6 @@ #files *.qm *.odt# -*_adaptor.h -*_proxy.h -genivi-*.h *.user diff --git a/src/poi-service/CMakeLists.txt b/src/poi-service/CMakeLists.txt index d2ee76b..e7b01e6 100644 --- a/src/poi-service/CMakeLists.txt +++ b/src/poi-service/CMakeLists.txt @@ -32,11 +32,10 @@ message(STATUS "WITH_FRANCA_INTERFACE = ${WITH_FRANCA_INTERFACE}") message(STATUS "WITH_DBUS_INTERFACE = ${WITH_DBUS_INTERFACE}") message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") -set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/poi-common") set(API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api") set(DBUS_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/dbus-include") -set(COMMON_API_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api/franca/navigation/src-gen") -set(DBUS_LIB_PATH "/usr/local/lib") +set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/poi-common") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) @@ -49,5 +48,7 @@ add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-servi add_subdirectory(poi-server) if (WITH_FRANCA_INTERFACE) + set(COMMON_API_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api/franca/navigation/src-gen") + set(DBUS_LIB_PATH "/usr/local/lib") add_subdirectory(poi-manager-server) endif() diff --git a/src/poi-service/poi-common/poi-common-data-model.h b/src/poi-service/poi-common/poi-common-data-model.h index 71d8e23..d90b3c0 100644 --- a/src/poi-service/poi-common/poi-common-data-model.h +++ b/src/poi-service/poi-common/poi-common-data-model.h @@ -102,4 +102,14 @@ typedef struct #define CAM_CATEGORY_OFFSET 0x0100 //offset added to create the id of a category provided by a CAM (to be multiplied by the camId) #define CAM_ATTRIBUTE_OFFSET 0x0100 //offset added to create the id of an attribute provided by a CAM (to be multiplied by the camId) +// some test defines +#define ICON_WIDTH 32 +#define ICON_HEIGHT 37 +#define ICON_URL "../resource/file" +#define ICON_FORMAT "png" +#define POI_PROVIDER "OpenStreetMap" +#define POI_NAME "mySweetHome" +#define SEARCH_STRING "Sweet" +#define MEDIASET 1 + #endif diff --git a/src/poi-service/poi-common/poi-common-dbus-data-model-new-variant.h b/src/poi-service/poi-common/poi-common-dbus-data-model-new-variant.h new file mode 100644 index 0000000..fcd9081 --- /dev/null +++ b/src/poi-service/poi-common/poi-common-dbus-data-model-new-variant.h @@ -0,0 +1,1895 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen +* +* \file poi-common-dbus-data-model.h +* +* \brief This file is part of the poi proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 1.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* 10-02-2014, Philippe Colliot, refinement and migration to the new repository +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef __POICOMMONDBUSDATAMODEL_H__ +#define __POICOMMONDBUSDATAMODEL_H__ + +#include <stdbool.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <iostream> +#include <fstream> + + +#include <dbus-c++/dbus.h> + +#include "poi-common-data-model.h" + +/* How to + The below classes are gateways between internal data and DBus data + Internal access is provided by set and get + DBus access is provided by setDBus and getDBus + Code rules: + if data name is MYNAME: +class DBus_MYNAME // DBus data type ex:(qqqs) +{ +public: + struct MYNAME_t //no class used into this public structure + { +... + }; + + typedef ... DBus_MYNAME_t; + + DBus_MYNAME(){ +... + } + + ~DBus_MYNAME(){} + + void set(MYNAME_t value){ +... + } + + MYNAME_t get(){ +... + return(m_MYNAME); + } + + void setDBus(DBus_MYNAME_t value){ +... + } + + DBus_MYNAME_t getDBus(){ + DBus_MYNAME_t return_value; +... + return(return_value); + } + +private: + MYNAME_t m_MYNAME; +}; + +*/ + +class DBus_dataFormatConverter +{ +public: + DBus_dataFormatConverter() + { + } + ~ DBus_dataFormatConverter() + { + } + DBus::Variant createVariantString(std::string str) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_string(str.c_str()); + return var; + } + + DBus::Variant createVariantBool(bool value) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_bool(value); + return var; + } + + DBus::Variant createVariantUint16(uint16_t value) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_uint16(value); + return var; + } + + DBus::Variant createVariantInt32(int32_t value) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_int32(value); + return var; + } + + DBus::Variant createVariantArrayUint16(std::vector< uint16_t > value) + { + DBus::Variant var; + DBus::MessageIter iter=var.writer(); + iter << value; + return var; + } + + DBus::Variant createVariantUint32(uint32_t value) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_uint32(value); + return var; + } + + DBus::Variant createVariantArrayUint32(std::vector< uint32_t > value) + { + DBus::Variant var; + DBus::MessageIter iter=var.writer(); + iter << value; + return var; + } + +}; + +class DBus_variantIcon : DBus_dataFormatConverter // (yv) +{ +public: + enum { + AS_VECTOR_OF_ID = 0, + AS_STRING = 1, + }; + + struct Icon_t + { + std::vector<resourceId_t> id; + std::string url; + }; + + struct variantIcon_t + { + uint8_t index; + Icon_t content; + }; + + typedef ::DBus::Struct< uint8_t, ::DBus::Variant > DBus_variantIcon_t; + + + DBus_variantIcon(){ + m_variantIcon.index = AS_STRING; + m_variantIcon.content.id.clear(); + m_variantIcon.content.url = ""; + } + + ~DBus_variantIcon(){} + + void set(variantIcon_t value){ + size_t index; + + switch (value.index) { + case 0: + m_variantIcon.content.id.clear(); + for (index=0;index<value.content.id.size();index++) + { + m_variantIcon.content.id.push_back(value.content.id.at(index)); + } + break; + case 1: + m_variantIcon.content.url = value.content.url; + default: + break; + } + } + + variantIcon_t get(){ + return(m_variantIcon); + } + + void setDBus(DBus_variantIcon_t value){ + size_t index; + std::string *str; + + m_variantIcon.index = value._1; + switch (value._1) { + case 0: + value._2.reader().get_array(str); + m_variantIcon.content.id.clear(); + + for (index=0;index<str->size();index++) + { + m_variantIcon.content.id.push_back(str->at(index)); + } + break; + case 1: + m_variantIcon.content.url = value._2.reader().get_string(); + default: + break; + } + } + + DBus_variantIcon_t getDBus(){ + size_t index; + DBus_variantIcon_t return_value; + + return_value._1 = m_variantIcon.index; + + switch (m_variantIcon.index) { + case 0: + return_value._2.clear(); + for (index=0;index<m_variantIcon.content.id.size();index++) + { + return_value._2 = createVariantArrayUint32(m_variantIcon.content.id); + } + break; + case 1: + return_value._2 = createVariantString(m_variantIcon.content.url); + default: + break; + } + + return(return_value); + } + +private: + variantIcon_t m_variantIcon; +}; + +class DBus_variantMedia : DBus_dataFormatConverter // (yv) +{ +public: + enum { + AS_VECTOR_OF_ID = 0, + AS_STRING = 1, + }; + + struct Media_t + { + std::vector<resourceId_t> id; + std::string url; + }; + + struct variantMedia_t + { + uint8_t index; + Media_t content; + }; + + typedef ::DBus::Struct< uint8_t, ::DBus::Variant > DBus_variantMedia_t; + + DBus_variantMedia(){ + m_variantMedia.index = AS_STRING; + m_variantMedia.content.id.clear(); + m_variantMedia.content.url = ""; + } + + ~DBus_variantMedia(){} + + void set(variantMedia_t value){ + size_t index; + + switch (value.index) { + case 0: + m_variantMedia.content.id.clear(); + for (index=0;index<value.content.id.size();index++) + { + m_variantMedia.content.id.push_back(value.content.id.at(index)); + } + break; + case 1: + m_variantMedia.content.url = value.content.url; + default: + break; + } + } + + variantMedia_t get(){ + return(m_variantMedia); + } + + void setDBus(DBus_variantMedia_t value){ + size_t index; + std::string *str; + + m_variantMedia.index = value._1; + switch (value._1) { + case 0: + value._2.reader().get_array(str); + m_variantMedia.content.id.clear(); + + for (index=0;index<str->size();index++) + { + m_variantMedia.content.id.push_back(str->at(index)); + } + break; + case 1: + m_variantMedia.content.url = value._2.reader().get_string(); + default: + break; + } + } + + DBus_variantMedia_t getDBus(){ + size_t index; + DBus_variantMedia_t return_value; + + return_value._1 = m_variantMedia.index; + + switch (m_variantMedia.index) { + case 0: + return_value._2.clear(); + for (index=0;index<m_variantMedia.content.id.size();index++) + { + return_value._2 = createVariantArrayUint32(m_variantMedia.content.id); + } + break; + case 1: + return_value._2 = createVariantString(m_variantMedia.content.url); + default: + break; + } + + return(return_value); + } + +private: + variantMedia_t m_variantMedia; +}; + +class DBus_variantAttributeValue : DBus_dataFormatConverter // (yv) +{ +public: + enum { + AS_INT32 = 0, + AS_STRING = 1, + AS_BOOL = 2 + }; + + struct AttributeValue_t + { + int32_t intValue; + std::string stringValue; + bool boolValue; + }; + + struct variantAttributeValue_t + { + uint8_t index; + AttributeValue_t content; + }; + + typedef ::DBus::Struct< uint8_t, ::DBus::Variant > DBus_variantAttributeValue_t; + + DBus_variantAttributeValue(){ + m_variantAttributeValue.index = AS_INT32; + m_variantAttributeValue.content.intValue = 0; + m_variantAttributeValue.content.stringValue = ""; + m_variantAttributeValue.content.boolValue = false; + } + + ~DBus_variantAttributeValue(){} + + void set(variantAttributeValue_t value){ + + switch (value.index) { + case 0: + m_variantAttributeValue.content.intValue = value.content.intValue; + break; + case 1: + m_variantAttributeValue.content.stringValue = value.content.stringValue; + case 2: + m_variantAttributeValue.content.boolValue = value.content.boolValue; + default: + break; + } + } + + variantAttributeValue_t get(){ + return(m_variantAttributeValue); + } + + void setDBus(DBus_variantAttributeValue_t value){ + m_variantAttributeValue.index = value._1; + switch (value._1) { + case 0: + m_variantAttributeValue.content.intValue = value._2.reader().get_int32(); + break; + case 1: + m_variantAttributeValue.content.stringValue = value._2.reader().get_string(); + case 2: + m_variantAttributeValue.content.boolValue = value._2.reader().get_bool(); + default: + break; + } + } + + DBus_variantAttributeValue_t getDBus(){ + DBus_variantAttributeValue_t return_value; + + return_value._1 = m_variantAttributeValue.index; + + switch (m_variantAttributeValue.index) { + case 0: + return_value._2 = createVariantInt32(m_variantAttributeValue.content.intValue); + break; + case 1: + return_value._2 = createVariantString(m_variantAttributeValue.content.stringValue); + case 2: + return_value._2 = createVariantBool(m_variantAttributeValue.content.boolValue); + default: + break; + } + + return(return_value); + } + +private: + variantAttributeValue_t m_variantAttributeValue; +}; + +class DBus_version : DBus_dataFormatConverter // (qqqs) +{ +public: + struct version_t + { + ushort major; + ushort minor; + ushort micro; + std::string date; + }; + + typedef ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > DBus_version_t; + + DBus_version(){ + m_version.major = 0; + m_version.minor = 0; + m_version.micro = 0; + m_version.date = ""; + } + + ~DBus_version(){} + + void set(version_t value){ + m_version.major = value.major; + m_version.minor = value.minor; + m_version.micro = value.micro; + m_version.date = value.date; + } + + version_t get(){ + return(m_version); + } + + void setDBus(DBus_version_t value){ + m_version.major = value._1; + m_version.minor = value._2; + m_version.micro = value._3; + m_version.date = value._4; + } + + DBus_version_t getDBus(){ + DBus_version_t return_value; + return_value._1 = m_version.major; + return_value._2 = m_version.minor; + return_value._3 = m_version.micro; + return_value._4 = m_version.date; + return(return_value); + } + +private: + version_t m_version; +}; + +class DBus_categoryDetails : DBus_dataFormatConverter // (uau(yv)sbs(yv)) +{ +public: + struct categoryDetails_t + { + categoryId_t id; //Category unique id + std::vector<categoryId_t> parents_id; //list of parent categories unique id + DBus_variantIcon::variantIcon_t icons; //visual icons set + std::string name; + bool top_level; //false if predefined, true if created by plugin + std::string description; //short category description (optional) + DBus_variantMedia::variantMedia_t media; //media associated (html web site, audio, video, ...) (optional) + }; + + typedef ::DBus::Struct< uint32_t, std::vector< uint32_t >, ::DBus::Struct< uint8_t, ::DBus::Variant >, std::string, bool, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > DBus_categoryDetails_t; + + DBus_categoryDetails() + { + DBus_variantIcon icons; + DBus_variantMedia media; + + m_categoryDetails.id = 0; + m_categoryDetails.parents_id.clear(); + m_categoryDetails.icons = icons.get(); + m_categoryDetails.name = ""; + m_categoryDetails.top_level = true; + m_categoryDetails.description = ""; + m_categoryDetails.media = media.get(); + } + + ~DBus_categoryDetails(){} + + void set(categoryDetails_t value) + { + size_t index; + m_categoryDetails.id = value.id; + m_categoryDetails.parents_id.clear(); + for (index=0;index<value.parents_id.size();index++) + { + m_categoryDetails.parents_id.push_back(value.parents_id.at(index)); + } + m_categoryDetails.icons = value.icons; + m_categoryDetails.name = value.name; + m_categoryDetails.top_level = value.top_level; + m_categoryDetails.description = value.description; + m_categoryDetails.media = value.media; + } + + categoryDetails_t get() + { + return(m_categoryDetails); + } + + void setDBus(DBus_categoryDetails_t value) + { + size_t index; + DBus_variantIcon icons; + DBus_variantMedia media; + + m_categoryDetails.id = value._1; + m_categoryDetails.parents_id.clear(); + for (index=0;index<value._2.size();index++) + { + m_categoryDetails.parents_id.push_back(value._2.at(index)); + } + icons.setDBus(value._3); + m_categoryDetails.icons = icons.get(); + m_categoryDetails.name = value._4; + m_categoryDetails.top_level = value._5; + m_categoryDetails.description = value._6; + media.setDBus(value._7); + m_categoryDetails.media = media.get(); + } + + DBus_categoryDetails_t getDBus() + { + size_t index; + DBus_variantIcon icons; + DBus_variantMedia media; + DBus_categoryDetails_t return_value; + + return_value._1 = m_categoryDetails.id; + return_value._2.clear(); + for (index=0;index<m_categoryDetails.parents_id.size();index++) + { + return_value._2.push_back(m_categoryDetails.parents_id.at(index)); + } + icons.set(m_categoryDetails.icons); + return_value._3 = icons.getDBus(); + return_value._4 = m_categoryDetails.name; + return_value._5 = m_categoryDetails.top_level; + return_value._6 = m_categoryDetails.description; + media.set(m_categoryDetails.media); + return_value._7 = media.getDBus(); + return(return_value); + } + +private: + categoryDetails_t m_categoryDetails; +}; + +class DBus_categoryOperator : DBus_dataFormatConverter // (is(yv)) +{ +public: + struct categoryOperator_t + { + int32_t type; //attribute operator type enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....) + std::string name; //attribute operator name + DBus_variantAttributeValue::variantAttributeValue_t value; //attribute operator value + }; + + typedef ::DBus::Struct< int32_t, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > DBus_categoryOperator_t; + + DBus_categoryOperator(){ + DBus_variantAttributeValue attributeValue; + + m_categoryOperator.type = 0; + m_categoryOperator.name = ""; + m_categoryOperator.value = attributeValue.get(); + } + + ~DBus_categoryOperator(){ + } + + void set(categoryOperator_t value){ + m_categoryOperator.type = value.type; + m_categoryOperator.name = value.name; + m_categoryOperator.value = value.value; + } + + categoryOperator_t get(){ + return(m_categoryOperator); + } + + void setDBus(DBus_categoryOperator_t value){ + DBus_variantAttributeValue attributeValue; + + m_categoryOperator.type = value._1; + m_categoryOperator.name = value._2; + + attributeValue.setDBus(value._3); + m_categoryOperator.value = attributeValue.get(); + } + + DBus_categoryOperator_t getDBus(){ + DBus_categoryOperator_t return_value; + DBus_variantAttributeValue attributeValue; + + return_value._1 = m_categoryOperator.type; + return_value._2 = m_categoryOperator.name; + + attributeValue.set(m_categoryOperator.value); + return_value._3 = attributeValue.getDBus(); + + return(return_value); + } + +private: + categoryOperator_t m_categoryOperator; +}; + +class DBus_categoryAttribute : DBus_dataFormatConverter // (usia(is(yv))) +{ +public: + struct categoryAttribute_t + { + attributeId_t id; //attribute unique id + std::string name; //attribute unique name + int32_t type; //enum(INVALID,STRING,INTEGER,COORDINATES ...) + std::vector<DBus_categoryOperator::categoryOperator_t > oper; + }; + + typedef ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > DBus_categoryAttribute_t; + + DBus_categoryAttribute(){ + m_categoryAttribute.id = 0; + m_categoryAttribute.name = ""; + m_categoryAttribute.type = 0; + m_categoryAttribute.oper.clear(); + } + + ~DBus_categoryAttribute(){ + } + + void set(categoryAttribute_t value){ + size_t index; + m_categoryAttribute.id = value.id; + m_categoryAttribute.name = value.name; + m_categoryAttribute.type = value.type; + m_categoryAttribute.oper.clear(); + for (index=0;index<value.oper.size();index++) + { + m_categoryAttribute.oper.push_back(value.oper.at(index)); + } + } + + categoryAttribute_t get(){ + return(m_categoryAttribute); + } + + void setDBus(DBus_categoryAttribute_t value){ + size_t index; + DBus_categoryOperator op; + m_categoryAttribute.id = value._1; + m_categoryAttribute.name = value._2; + m_categoryAttribute.type = value._3; + m_categoryAttribute.oper.clear(); + for (index=0;index<value._4.size();index++) + { + op.setDBus(value._4.at(index)); + m_categoryAttribute.oper.push_back(op.get()); + } + } + + DBus_categoryAttribute_t getDBus(){ + DBus_categoryAttribute_t return_value; + size_t index; + DBus_categoryOperator op; + return_value._1 = m_categoryAttribute.id; + return_value._2 = m_categoryAttribute.name; + return_value._3 = m_categoryAttribute.type; + return_value._4.clear(); + for (index=0;index<m_categoryAttribute.oper.size();index++) + { + op.set(m_categoryAttribute.oper.at(index)); + return_value._4.push_back(op.getDBus()); + } + return(return_value); + } + +private: + categoryAttribute_t m_categoryAttribute; +}; + +class DBus_categorySortOption : DBus_dataFormatConverter // (us) +{ +public: + struct categorySortOption_t + { + uint32_t id; //enum(GENIVI_POISERVICE_SORT_DEFAULT,GENIVI_POISERVICE_SORT_BY_DISTANCE,GENIVI_POISERVICE_SORT_BY_TIME ... ) + std::string name; //name to be displayed by application + }; + + typedef ::DBus::Struct< uint32_t, std::string > DBus_categorySortOption_t; + + DBus_categorySortOption(){ + m_categorySortOption.id = 0; + m_categorySortOption.name = ""; + } + + ~DBus_categorySortOption(){ + } + + void set(categorySortOption_t value){ + m_categorySortOption.id = value.id; + m_categorySortOption.name = value.name; + } + + categorySortOption_t get(){ + return(m_categorySortOption); + } + + void setDBus(DBus_categorySortOption_t value){ + m_categorySortOption.id = value._1; + m_categorySortOption.name = value._2; + } + + DBus_categorySortOption_t getDBus(){ + DBus_categorySortOption_t return_value; + return_value._1 = m_categorySortOption.id; + return_value._2 = m_categorySortOption.name; + return(return_value); + } + +private: + categorySortOption_t m_categorySortOption; +}; + +class DBus_category : DBus_dataFormatConverter // ( (uau(yv)sbs(yv)) a(usia(is(yv))) a(us) ) +{ +public: + struct category_t + { + DBus_categoryDetails::categoryDetails_t details; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< ::DBus::Struct< uint32_t, std::vector< uint32_t >, ::DBus::Struct< uint8_t, ::DBus::Variant >, std::string, bool, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > >, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_category_t; + + DBus_category() + { + DBus_categoryDetails details; + + m_category.details = details.get(); + m_category.attributes.clear(); + m_category.sortOptions.clear(); + } + + ~ DBus_category(){} + + void set(category_t value) + { + size_t index; + m_category.details = value.details; + m_category.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_category.attributes.push_back(value.attributes.at(index)); + } + m_category.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_category.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + category_t get() + { + return(m_category); + } + + void setDBus(DBus_category_t value) + { + size_t index; + DBus_categoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.setDBus(value._1); + m_category.details = details.get(); + m_category.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_category.attributes.push_back(attrib.get()); + } + m_category.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_category.sortOptions.push_back(sortOption.get()); + } + } + + DBus_category_t getDBus() + { + DBus_category_t return_value; + size_t index; + DBus_categoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.set(m_category.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for(index=0;index<m_category.attributes.size();index++) + { + attrib.set(m_category.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_category.sortOptions.size();index++) + { + sortOption.set(m_category.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + category_t m_category; +}; + +class DBus_categoryIdLevel : DBus_dataFormatConverter // (ub) +{ +public: + struct categoryIdLevel_t + { + categoryId_t id; + bool top_level; //false if predefined, true if created by plugin + }; + + typedef ::DBus::Struct< uint32_t, bool > DBus_categoryIdLevel_t; + + + DBus_categoryIdLevel(){ + m_categoryIdLevel.id = 0; + m_categoryIdLevel.top_level = true; + } + + ~DBus_categoryIdLevel(){} + + void set(categoryIdLevel_t value){ + m_categoryIdLevel.id = value.id; + m_categoryIdLevel.top_level = value.top_level; + } + + categoryIdLevel_t get(){ + return(m_categoryIdLevel); + } + + void setDBus(DBus_categoryIdLevel_t value){ + m_categoryIdLevel.id = value._1; + m_categoryIdLevel.top_level = value._2; + } + + DBus_categoryIdLevel_t getDBus(){ + DBus_categoryIdLevel_t return_value; + return_value._1 = m_categoryIdLevel.id; + return_value._2 = m_categoryIdLevel.top_level; + return(return_value); + } + +private: + categoryIdLevel_t m_categoryIdLevel; +}; + +class DBus_categoryReason : DBus_dataFormatConverter // (uq) +{ +public: + struct categoryReason_t + { + categoryId_t id; + ushort reason; //enum(ADDED,REMOVED,ATTR_ADDED,ATTR_MODIFIED,ATTR_REMOVED, ... ) + }; + + typedef ::DBus::Struct< uint32_t, uint16_t > DBus_categoryReason_t; + + + DBus_categoryReason(){ + m_categoryReason.id = 0; + m_categoryReason.reason = true; + } + + ~DBus_categoryReason(){} + + void set(categoryReason_t value){ + m_categoryReason.id = value.id; + m_categoryReason.reason = value.reason; + } + + categoryReason_t get(){ + return(m_categoryReason); + } + + void setDBus(DBus_categoryReason_t value){ + m_categoryReason.id = value._1; + m_categoryReason.reason = value._2; + } + + DBus_categoryReason_t getDBus(){ + DBus_categoryReason_t return_value; + return_value._1 = m_categoryReason.id; + return_value._2 = m_categoryReason.reason; + return(return_value); + } + +private: + categoryReason_t m_categoryReason; +}; + +class DBus_categoryIdName : DBus_categoryIdLevel // (usb) +{ +public: + + struct categoryIdName_t + { + DBus_categoryIdLevel::categoryIdLevel_t id; + std::string name; + }; + + typedef ::DBus::Struct< uint32_t, std::string, bool > DBus_categoryIdName_t; + + + DBus_categoryIdName(){ + m_categoryIdName = ""; + } + + ~DBus_categoryIdName(){} + + void set(categoryIdName_t value){ + DBus_categoryIdLevel::set(value.id); + m_categoryIdName = value.name; + } + + categoryIdName_t get(){ + categoryIdName_t return_value; + return_value.id = DBus_categoryIdLevel::get(); + return_value.name = m_categoryIdName; + return(return_value); + } + + void setDBus(DBus_categoryIdName_t value){ + DBus_categoryIdLevel::DBus_categoryIdLevel_t id; + id._1 = value._1; + id._2 = value._3; + DBus_categoryIdLevel::setDBus(id); + m_categoryIdName = value._2; + } + + DBus_categoryIdName_t getDBus(){ + DBus_categoryIdName_t return_value; + DBus_categoryIdLevel::DBus_categoryIdLevel_t id; + id = DBus_categoryIdLevel::getDBus(); + return_value._1 = id._1; + return_value._2 = m_categoryIdName; + return_value._3 = id._2; + return(return_value); + } + +private: + std::string m_categoryIdName; +}; + +class DBus_categoryRadius : DBus_dataFormatConverter // (uu) +{ +public: + struct categoryRadius_t + { + categoryId_t id; + uint radius; + }; + + typedef ::DBus::Struct< uint32_t, uint32_t > DBus_categoryRadius_t; + + DBus_categoryRadius(){ + m_categoryRadius.id = 0; + m_categoryRadius.radius = 0; + } + + ~DBus_categoryRadius(){} + + void set(categoryRadius_t value){ + m_categoryRadius.id = value.id; + m_categoryRadius.radius = value.radius; + } + + categoryRadius_t get(){ + return(m_categoryRadius); + } + + void setDBus(DBus_categoryRadius_t value){ + m_categoryRadius.id = value._1; + m_categoryRadius.radius = value._2; + } + + DBus_categoryRadius_t getDBus(){ + DBus_categoryRadius_t return_value; + return_value._1 = m_categoryRadius.id; + return_value._2 = m_categoryRadius.radius; + return(return_value); + } + +private: + categoryRadius_t m_categoryRadius; +}; + +class DBus_poiAttribute : DBus_dataFormatConverter // (ui(yv)) +{ +public: + struct poiAttribute_t + { + attributeId_t id; + int32_t type; + DBus_variantAttributeValue::variantAttributeValue_t value; + }; + + typedef ::DBus::Struct< uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > DBus_poiAttribute_t; + + + DBus_poiAttribute(){ + DBus_variantAttributeValue attributeValue; + + m_attribute.id = 0; + m_attribute.type = 0; + m_attribute.value = attributeValue.get(); + } + + ~DBus_poiAttribute(){} + + void set(poiAttribute_t value){ + m_attribute.id = value.id; + m_attribute.type = value.type; + m_attribute.value = value.value; + } + + poiAttribute_t get(){ + return(m_attribute); + } + + void setDBus(DBus_poiAttribute_t value){ + DBus_variantAttributeValue attributeValue; + + m_attribute.id = value._1; + m_attribute.type = value._2; + attributeValue.setDBus(value._3); + m_attribute.value = attributeValue.get(); + } + + DBus_poiAttribute_t getDBus(){ + DBus_poiAttribute_t return_value; + DBus_variantAttributeValue attributeValue; + + return_value._1 = m_attribute.id; + return_value._2 = m_attribute.type; + attributeValue.set(m_attribute.value); + return_value._3 = attributeValue.getDBus(); + return(return_value); + } + +private: + poiAttribute_t m_attribute; +}; + +class DBus_attributeDetails : DBus_poiAttribute //(uui(yv)ib) +{ +public: + struct attributeDetails_t + { + DBus_poiAttribute::poiAttribute_t attribute; + categoryId_t categoryId; //Category unique id + int32_t oper; //enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....) + bool mandatory; //true if the attribute is mandatory for the search and false for optional + }; + + typedef ::DBus::Struct< uint32_t, uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant >, int32_t, bool > DBus_attributeDetails_t; + + + DBus_attributeDetails(){ + DBus_poiAttribute attribute; + + m_attributeDetails.attribute = attribute.get(); + m_attributeDetails.categoryId = 0; + m_attributeDetails.oper = 0; + m_attributeDetails.mandatory = true; + } + + ~DBus_attributeDetails(){} + + void set(attributeDetails_t value){ + DBus_poiAttribute::set(value.attribute); + m_attributeDetails.categoryId = value.categoryId; + m_attributeDetails.oper = value.oper; + m_attributeDetails.mandatory = value.mandatory; + } + + attributeDetails_t get(){ + attributeDetails_t return_value; + return_value.attribute = DBus_poiAttribute::get(); + return_value.categoryId = m_attributeDetails.categoryId; + return_value.oper = m_attributeDetails.oper; + return_value.mandatory = m_attributeDetails.mandatory; + return(return_value); + } + + void setDBus(DBus_attributeDetails_t value){ + DBus_poiAttribute::DBus_poiAttribute_t attribute; + attribute._1 = value._1; + attribute._2 = value._3; + attribute._3 = value._4; + DBus_poiAttribute::setDBus(attribute); + m_attributeDetails.categoryId = value._2; + m_attributeDetails.oper = value._5; + m_attributeDetails.mandatory = value._6; + } + + DBus_attributeDetails_t getDBus(){ + DBus_attributeDetails_t return_value; + DBus_poiAttribute::DBus_poiAttribute_t attribute; + attribute = DBus_poiAttribute::getDBus(); + return_value._1 = attribute._1; + return_value._2 = m_attributeDetails.categoryId; + return_value._3 = attribute._2; + return_value._4 = attribute._3; + return_value._5 = m_attributeDetails.oper; + return_value._6 = m_attributeDetails.mandatory; + return(return_value); + } + +private: + attributeDetails_t m_attributeDetails; +}; + +class DBus_geoCoordinate3D : DBus_dataFormatConverter //(ddi) +{ +public: + struct geoCoordinate3D_t + { + double latitude; + double longitude; + int altitude; + }; + typedef ::DBus::Struct< double, double, int32_t > DBus_geoCoordinate3D_t; + + DBus_geoCoordinate3D(){ + m_geoCoordinate3D.latitude = 48.85792; //by default center of Paris + m_geoCoordinate3D.longitude = 2.3383145; + m_geoCoordinate3D.altitude = 0; + } + + ~DBus_geoCoordinate3D(){} + + void set(geoCoordinate3D_t value){ + m_geoCoordinate3D.latitude = value.latitude; + m_geoCoordinate3D.longitude = value.longitude; + m_geoCoordinate3D.altitude = value.altitude; + } + + geoCoordinate3D_t get(){ + return(m_geoCoordinate3D); + } + + void setDBus(DBus_geoCoordinate3D_t value){ + m_geoCoordinate3D.latitude = value._1; + m_geoCoordinate3D.longitude = value._2; + m_geoCoordinate3D.altitude = value._3; + } + + DBus_geoCoordinate3D_t getDBus(){ + DBus_geoCoordinate3D_t return_value; + return_value._1 = m_geoCoordinate3D.latitude; + return_value._2 = m_geoCoordinate3D.longitude; + return_value._3 = m_geoCoordinate3D.altitude; + return(return_value); + } + +private: + geoCoordinate3D_t m_geoCoordinate3D; +}; + +class DBus_poiDetails : DBus_dataFormatConverter //(us(ddi)) +{ +public: + struct poiDetails_t + { + poiId_t id; + std::string name; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + }; + typedef ::DBus::Struct< uint32_t, std::string, ::DBus::Struct< double, double, int32_t > > DBus_poiDetails_t; + + DBus_poiDetails(){ + DBus_geoCoordinate3D loc; + + m_poiDetails.id = 0; + m_poiDetails.name = ""; + m_poiDetails.location = loc.get(); + } + + ~DBus_poiDetails(){} + + void set(poiDetails_t value){ + m_poiDetails.id = value.id; + m_poiDetails.name = value.name; + m_poiDetails.location = value.location; + } + + poiDetails_t get(){ + return(m_poiDetails); + } + + void setDBus(DBus_poiDetails_t value){ + DBus_geoCoordinate3D loc; + + m_poiDetails.id = value._1; + m_poiDetails.name = value._2; + loc.setDBus(value._3); + m_poiDetails.location = loc.get(); + } + + DBus_poiDetails_t getDBus(){ + DBus_geoCoordinate3D loc; + DBus_poiDetails_t return_value; + return_value._1 = m_poiDetails.id; + return_value._2 = m_poiDetails.name; + loc.set(m_poiDetails.location); + return_value._3 = loc.getDBus(); + return(return_value); + } + +private: + poiDetails_t m_poiDetails; +}; + +class DBus_searchResult : DBus_dataFormatConverter //(uuqa(ui(yv))) +{ +public: + struct searchResult_t + { + poiId_t id; + uint distance; + ushort route_status; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< uint32_t, uint32_t, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > DBus_searchResult_t; + + DBus_searchResult(){ + m_searchResult.id = 0; + m_searchResult.distance = 0; + m_searchResult.route_status = 0; + m_searchResult.attributes.clear(); + } + + ~DBus_searchResult(){ + } + + void set(searchResult_t value){ + size_t index; + m_searchResult.id = value.id; + m_searchResult.distance = value.distance; + m_searchResult.route_status = value.route_status; + m_searchResult.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_searchResult.attributes.push_back(value.attributes.at(index)); + } + } + + searchResult_t get(){ + return(m_searchResult); + } + + void setDBus(DBus_searchResult_t value){ + size_t index; + DBus_poiAttribute attrib; + m_searchResult.id = value._1; + m_searchResult.distance = value._2; + m_searchResult.route_status = value._3; + m_searchResult.attributes.clear(); + for (index=0;index<value._4.size();index++) + { + attrib.setDBus(value._4.at(index)); + m_searchResult.attributes.push_back(attrib.get()); + } + } + + DBus_searchResult_t getDBus(){ + DBus_searchResult_t return_value; + size_t index; + DBus_poiAttribute attrib; + return_value._1 = m_searchResult.id; + return_value._2 = m_searchResult.distance; + return_value._3 = m_searchResult.route_status; + return_value._4.clear(); + for (index=0;index<m_searchResult.attributes.size();index++) + { + attrib.set(m_searchResult.attributes.at(index)); + return_value._4.push_back(attrib.getDBus()); + } + return(return_value); + } + +private: + searchResult_t m_searchResult; +}; + +class DBus_searchResultDetails : DBus_dataFormatConverter // ((us(ddi))aua(ui(yv))) +{ +public: + struct searchResultDetails_t + { + DBus_poiDetails::poiDetails_t details; + std::vector<categoryId_t> categories; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< ::DBus::Struct< uint32_t, std::string, ::DBus::Struct< double, double, int32_t > >, std::vector< uint32_t >, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > DBus_searchResultDetails_t; + + + DBus_searchResultDetails(){ + DBus_poiDetails details; + + m_searchResultDetails.details = details.get(); + m_searchResultDetails.categories.clear(); + m_searchResultDetails.attributes.clear(); + } + + ~DBus_searchResultDetails(){} + + void set(searchResultDetails_t value){ + size_t index; + m_searchResultDetails.details = value.details; + m_searchResultDetails.categories.clear(); + for (index=0;index<value.categories.size();index++) + { + m_searchResultDetails.categories.push_back(value.categories.at(index)); + } + m_searchResultDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_searchResultDetails.attributes.push_back(value.attributes.at(index)); + } + } + + searchResultDetails_t get(){ + return(m_searchResultDetails); + } + + void setDBus(DBus_searchResultDetails_t value){ + size_t index; + DBus_poiDetails details; + DBus_poiAttribute attrib; + + details.setDBus(value._1); + m_searchResultDetails.details = details.get(); + m_searchResultDetails.categories.clear(); + for (index=0;index<value._2.size();index++) + { + m_searchResultDetails.categories.push_back(value._2.at(index)); + } + m_searchResultDetails.attributes.clear(); + for (index=0;index<value._3.size();index++) + { + attrib.setDBus(value._3.at(index)); + m_searchResultDetails.attributes.push_back(attrib.get()); + } + } + + DBus_searchResultDetails_t getDBus(){ + DBus_searchResultDetails_t return_value; + size_t index; + DBus_poiDetails details; + DBus_poiAttribute attrib; + + details.set(m_searchResultDetails.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for (index=0;index<m_searchResultDetails.categories.size();index++) + { + return_value._2.push_back(m_searchResultDetails.categories.at(index)); + } + return_value._3.clear(); + for (index=0;index<m_searchResultDetails.attributes.size();index++) + { + attrib.set(m_searchResultDetails.attributes.at(index)); + return_value._3.push_back(attrib.getDBus()); + } + + return(return_value); + } + +private: + searchResultDetails_t m_searchResultDetails; +}; + +class DBus_poiCAMDetails : DBus_dataFormatConverter // (usq(ddi)qa(ui(yv))) +{ +public: + struct poiCAMDetails_t + { + poiId_t source_id; + std::string name; + categoryId_t category; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + ushort distance; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< uint32_t, std::string, uint32_t, ::DBus::Struct< double, double, int32_t >, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > DBus_poiCAMDetails_t; + + DBus_poiCAMDetails(){ + DBus_geoCoordinate3D loc; + + m_poiCAMDetails.source_id = 0; + m_poiCAMDetails.name = ""; + m_poiCAMDetails.category = 0; + m_poiCAMDetails.location = loc.get(); + m_poiCAMDetails.distance = 0; + m_poiCAMDetails.attributes.clear(); + } + + ~DBus_poiCAMDetails(){} + + void set(poiCAMDetails_t value){ + size_t index; + + m_poiCAMDetails.source_id = value.source_id; + m_poiCAMDetails.name = value.name; + m_poiCAMDetails.category = value.category; + m_poiCAMDetails.location = value.location; + m_poiCAMDetails.distance = value.distance; + m_poiCAMDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_poiCAMDetails.attributes.push_back(value.attributes.at(index)); + } + } + + poiCAMDetails_t get(){ + return(m_poiCAMDetails); + } + + void setDBus(DBus_poiCAMDetails_t value){ + size_t index; + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + m_poiCAMDetails.source_id = value._1; + m_poiCAMDetails.name = value._2; + m_poiCAMDetails.category = value._3; + loc.setDBus(value._4); + m_poiCAMDetails.location = loc.get(); + m_poiCAMDetails.distance = value._5, + m_poiCAMDetails.attributes.clear(); + for (index=0;index<value._6.size();index++) + { + attrib.setDBus(value._6.at(index)); + m_poiCAMDetails.attributes.push_back(attrib.get()); + } + } + + DBus_poiCAMDetails_t getDBus(){ + DBus_poiCAMDetails_t return_value; + size_t index; + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + return_value._1 = m_poiCAMDetails.source_id; + return_value._2 = m_poiCAMDetails.name; + return_value._3 = m_poiCAMDetails.category; + loc.set(m_poiCAMDetails.location); + return_value._4 = loc.getDBus(); + return_value._5 = m_poiCAMDetails.distance; + return_value._6.clear(); + for (index=0;index<m_poiCAMDetails.attributes.size();index++) + { + attrib.set(m_poiCAMDetails.attributes.at(index)); + return_value._6.push_back(attrib.getDBus()); + } + return(return_value); + } + +private: + poiCAMDetails_t m_poiCAMDetails; +}; + +class DBus_CAMcategoryDetails : DBus_dataFormatConverter // (au(yv)ss(yv)) +{ +public: + struct CAMcategoryDetails_t + { + std::vector<categoryId_t> parents_id; + DBus_variantIcon::variantIcon_t icons; + std::string name; + std::string short_desc; + DBus_variantMedia::variantMedia_t media; + }; + + typedef ::DBus::Struct< std::vector< uint32_t >, ::DBus::Struct< uint8_t, ::DBus::Variant >, std::string, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > DBus_CAMcategoryDetails_t; + + DBus_CAMcategoryDetails(){ + DBus_variantIcon icons; + DBus_variantMedia media; + + m_CAMcategoryDetails.parents_id.clear(); + m_CAMcategoryDetails.icons = icons.get(); + m_CAMcategoryDetails.name = ""; + m_CAMcategoryDetails.short_desc = ""; + m_CAMcategoryDetails.media = media.get(); + } + + ~DBus_CAMcategoryDetails(){} + + void set(CAMcategoryDetails_t value){ + size_t index; + + m_CAMcategoryDetails.parents_id.clear(); + for (index=0;index<value.parents_id.size();index++) + { + m_CAMcategoryDetails.parents_id.push_back(value.parents_id.at(index)); + } + m_CAMcategoryDetails.icons = value.icons; + m_CAMcategoryDetails.name = value.name; + m_CAMcategoryDetails.short_desc = value.short_desc; + m_CAMcategoryDetails.media = value.media; + } + + CAMcategoryDetails_t get(){ + return(m_CAMcategoryDetails); + } + + void setDBus(DBus_CAMcategoryDetails_t value){ + size_t index; + DBus_variantIcon icons; + DBus_variantMedia media; + + m_CAMcategoryDetails.parents_id.clear(); + for (index=0;index<value._1.size();index++) + { + m_CAMcategoryDetails.parents_id.push_back(value._1.at(index)); + } + + icons.setDBus(value._2); + m_CAMcategoryDetails.icons = icons.get(); + + m_CAMcategoryDetails.name = value._3; + m_CAMcategoryDetails.short_desc = value._4; + + media.setDBus(value._5); + m_CAMcategoryDetails.media = media.get(); + } + + DBus_CAMcategoryDetails_t getDBus(){ + DBus_CAMcategoryDetails_t return_value; + size_t index; + DBus_variantIcon icons; + DBus_variantMedia media; + + return_value._1.clear(); + for (index=0;index<m_CAMcategoryDetails.parents_id.size();index++) + { + return_value._1.push_back(m_CAMcategoryDetails.parents_id.at(index)); + } + + icons.set(m_CAMcategoryDetails.icons); + return_value._2 = icons.getDBus(); + return_value._3 = m_CAMcategoryDetails.name; + return_value._4 = m_CAMcategoryDetails.short_desc; + + media.set(m_CAMcategoryDetails.media); + return_value._5 = media.getDBus(); + return(return_value); + } + +private: + CAMcategoryDetails_t m_CAMcategoryDetails; +}; + +class DBus_CAMcategory : DBus_dataFormatConverter // ((au(yv)ss(yv))a(usia(is(yv)))a(us)) -->in this implementation, the variant data is string +{ +public: + struct CAMcategory_t //no class used into this public structure + { + DBus_CAMcategoryDetails::CAMcategoryDetails_t details; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< ::DBus::Struct< std::vector< uint32_t >, ::DBus::Struct< uint8_t, ::DBus::Variant >, std::string, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > >, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_CAMcategory_t; + + DBus_CAMcategory(){ + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_CAMcategory.details = details.get(); + m_CAMcategory.attributes.clear(); + m_CAMcategory.sortOptions.clear(); + } + + ~DBus_CAMcategory(){} + + void set(CAMcategory_t value){ + size_t index; + m_CAMcategory.details = value.details; + m_CAMcategory.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_CAMcategory.attributes.push_back(value.attributes.at(index)); + } + m_CAMcategory.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_CAMcategory.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + CAMcategory_t get(){ + return(m_CAMcategory); + } + + void setDBus(DBus_CAMcategory_t value){ + size_t index; + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.setDBus(value._1); + m_CAMcategory.details = details.get(); + m_CAMcategory.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_CAMcategory.attributes.push_back(attrib.get()); + } + m_CAMcategory.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_CAMcategory.sortOptions.push_back(sortOption.get()); + } + } + + DBus_CAMcategory_t getDBus(){ + DBus_CAMcategory_t return_value; + size_t index; + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.set(m_CAMcategory.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for(index=0;index<m_CAMcategory.attributes.size();index++) + { + attrib.set(m_CAMcategory.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_CAMcategory.sortOptions.size();index++) + { + sortOption.set(m_CAMcategory.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + CAMcategory_t m_CAMcategory; +}; + +class DBus_CAMcategoryUpdate : DBus_dataFormatConverter // (ua(usia(is(yv)))a(us)) +{ +public: + struct CAMcategoryUpdate_t + { + categoryId_t unique_id; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< uint32_t, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_CAMcategoryUpdate_t; + + DBus_CAMcategoryUpdate(){ + m_CAMcategoryUpdate.unique_id = 0; + m_CAMcategoryUpdate.attributes.clear(); + m_CAMcategoryUpdate.sortOptions.clear(); + } + + ~DBus_CAMcategoryUpdate(){} + + void set(CAMcategoryUpdate_t value){ + size_t index; + m_CAMcategoryUpdate.unique_id = value.unique_id; + m_CAMcategoryUpdate.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_CAMcategoryUpdate.attributes.push_back(value.attributes.at(index)); + } + m_CAMcategoryUpdate.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_CAMcategoryUpdate.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + CAMcategoryUpdate_t get(){ + return(m_CAMcategoryUpdate); + } + + void setDBus(DBus_CAMcategoryUpdate_t value){ + size_t index; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_CAMcategoryUpdate.unique_id = value._1; + m_CAMcategoryUpdate.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_CAMcategoryUpdate.attributes.push_back(attrib.get()); + } + m_CAMcategoryUpdate.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_CAMcategoryUpdate.sortOptions.push_back(sortOption.get()); + } + } + + DBus_CAMcategoryUpdate_t getDBus(){ + DBus_CAMcategoryUpdate_t return_value; + size_t index; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + return_value._1 = m_CAMcategoryUpdate.unique_id; + return_value._2.clear(); + for(index=0;index<m_CAMcategoryUpdate.attributes.size();index++) + { + attrib.set(m_CAMcategoryUpdate.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_CAMcategoryUpdate.sortOptions.size();index++) + { + sortOption.set(m_CAMcategoryUpdate.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + CAMcategoryUpdate_t m_CAMcategoryUpdate; +}; + +class DBus_PoiAddedDetails : DBus_dataFormatConverter // (s(ddi)a(ui(yv))) +{ +public: + struct PoiAddedDetails_t + { + std::string name; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< std::string, ::DBus::Struct< double, double, int32_t >, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > DBus_PoiAddedDetails_t; + + + DBus_PoiAddedDetails(){ + DBus_geoCoordinate3D loc; + + m_PoiAddedDetails.name = ""; + m_PoiAddedDetails.location = loc.get(); + m_PoiAddedDetails.attributes.clear(); + } + + ~DBus_PoiAddedDetails(){} + + void set(PoiAddedDetails_t value){ + size_t index; + m_PoiAddedDetails.name = value.name; + m_PoiAddedDetails.location = value.location; + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_PoiAddedDetails.attributes.push_back(value.attributes.at(index)); + } + } + + PoiAddedDetails_t get(){ + return(m_PoiAddedDetails); + } + + void setDBus(DBus_PoiAddedDetails_t value){ + DBus_geoCoordinate3D loc; + size_t index; + DBus_poiAttribute attrib; + + m_PoiAddedDetails.name = value._1; + loc.setDBus(value._2); + m_PoiAddedDetails.location = loc.get(); + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value._3.size();index++) + { + attrib.setDBus(value._3.at(index)); + m_PoiAddedDetails.attributes.push_back(attrib.get()); + } + } + + DBus_PoiAddedDetails_t getDBus(){ + DBus_PoiAddedDetails_t return_value; + size_t index; + DBus_poiAttribute attrib; + DBus_geoCoordinate3D loc; + + return_value._1 = m_PoiAddedDetails.name; + + loc.set(m_PoiAddedDetails.location); + return_value._2 = loc.getDBus(); + + return_value._3.clear(); + for (index=0;index<m_PoiAddedDetails.attributes.size();index++) + { + attrib.set(m_PoiAddedDetails.attributes.at(index)); + return_value._3.push_back(attrib.getDBus()); + } + + return(return_value); + } + +private: + PoiAddedDetails_t m_PoiAddedDetails; +}; + + +#endif diff --git a/src/poi-service/poi-common/poi-common-dbus-data-model.h b/src/poi-service/poi-common/poi-common-dbus-data-model.h index af9f927..2b28c94 100644 --- a/src/poi-service/poi-common/poi-common-dbus-data-model.h +++ b/src/poi-service/poi-common/poi-common-dbus-data-model.h @@ -121,6 +121,22 @@ public: return var; } + DBus::Variant createVariantUint32(uint32_t value) + { + DBus::Variant var; + DBus::MessageIter iter = var.writer(); + iter.append_uint32(value); + return var; + } + + DBus::Variant createVariantArrayUint32(std::vector< uint32_t > value) + { + DBus::Variant var; + DBus::MessageIter iter=var.writer(); + iter << value; + return var; + } + }; class DBus_version : DBus_dataFormatConverter // (qqqs) @@ -718,45 +734,45 @@ private: categoryRadius_t m_categoryRadius; }; -class DBus_attribute : DBus_dataFormatConverter // (uiv) -->in this implementation, the variant data is a string +class DBus_poiAttribute : DBus_dataFormatConverter // (uiv) -->in this implementation, the variant data is a string { public: - struct attribute_t + struct poiAttribute_t { attributeId_t id; int32_t type; std::string value; }; - typedef ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > DBus_attribute_t; + typedef ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > DBus_poiAttribute_t; - DBus_attribute(){ + DBus_poiAttribute(){ m_attribute.id = 0; m_attribute.type = 0; m_attribute.value = ""; } - ~DBus_attribute(){} + ~DBus_poiAttribute(){} - void set(attribute_t value){ + void set(poiAttribute_t value){ m_attribute.id = value.id; m_attribute.type = value.type; m_attribute.value = value.value; } - attribute_t get(){ + poiAttribute_t get(){ return(m_attribute); } - void setDBus(DBus_attribute_t value){ + void setDBus(DBus_poiAttribute_t value){ m_attribute.id = value._1; m_attribute.type = value._2; m_attribute.value = value._3.reader().get_string(); } - DBus_attribute_t getDBus(){ - DBus_attribute_t return_value; + DBus_poiAttribute_t getDBus(){ + DBus_poiAttribute_t return_value; return_value._1 = m_attribute.id; return_value._2 = m_attribute.type; return_value._3 = createVariantString(m_attribute.value); @@ -764,15 +780,15 @@ public: } private: - attribute_t m_attribute; + poiAttribute_t m_attribute; }; -class DBus_attributeDetails : DBus_attribute //(uuivib) -->in this implementation, the variant data is string +class DBus_attributeDetails : DBus_poiAttribute //(uuivib) -->in this implementation, the variant data is string { public: struct attributeDetails_t { - DBus_attribute::attribute_t attribute; + DBus_poiAttribute::poiAttribute_t attribute; categoryId_t categoryId; //Category unique id int32_t oper; //enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....) bool mandatory; //true if the attribute is mandatory for the search and false for optional @@ -790,7 +806,7 @@ public: ~DBus_attributeDetails(){} void set(attributeDetails_t value){ - DBus_attribute::set(value.attribute); + DBus_poiAttribute::set(value.attribute); m_attributeDetails.categoryId = value.categoryId; m_attributeDetails.oper = value.oper; m_attributeDetails.mandatory = value.mandatory; @@ -798,7 +814,7 @@ public: attributeDetails_t get(){ attributeDetails_t return_value; - return_value.attribute = DBus_attribute::get(); + return_value.attribute = DBus_poiAttribute::get(); return_value.categoryId = m_attributeDetails.categoryId; return_value.oper = m_attributeDetails.oper; return_value.mandatory = m_attributeDetails.mandatory; @@ -806,11 +822,11 @@ public: } void setDBus(DBus_attributeDetails_t value){ - DBus_attribute::DBus_attribute_t attribute; + DBus_poiAttribute::DBus_poiAttribute_t attribute; attribute._1 = value._1; attribute._2 = value._3; attribute._3 = value._4; - DBus_attribute::setDBus(attribute); + DBus_poiAttribute::setDBus(attribute); m_attributeDetails.categoryId = value._2; m_attributeDetails.oper = value._5; m_attributeDetails.mandatory = value._6; @@ -818,8 +834,8 @@ public: DBus_attributeDetails_t getDBus(){ DBus_attributeDetails_t return_value; - DBus_attribute::DBus_attribute_t attribute; - attribute = DBus_attribute::getDBus(); + DBus_poiAttribute::DBus_poiAttribute_t attribute; + attribute = DBus_poiAttribute::getDBus(); return_value._1 = attribute._1; return_value._2 = m_attributeDetails.categoryId; return_value._3 = attribute._2; @@ -942,13 +958,13 @@ public: poiId_t id; uint distance; ushort route_status; - std::vector<DBus_attribute::attribute_t> attributes; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; }; typedef ::DBus::Struct< uint32_t, uint32_t, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > > > DBus_searchResult_t; DBus_searchResult(){ - DBus_attribute attrib; + DBus_poiAttribute attrib; m_searchResult.id = 0; m_searchResult.distance = 0; m_searchResult.route_status = 0; @@ -977,7 +993,7 @@ public: void setDBus(DBus_searchResult_t value){ size_t index; - DBus_attribute attrib; + DBus_poiAttribute attrib; m_searchResult.id = value._1; m_searchResult.distance = value._2; m_searchResult.route_status = value._3; @@ -992,7 +1008,7 @@ public: DBus_searchResult_t getDBus(){ DBus_searchResult_t return_value; size_t index; - DBus_attribute attrib; + DBus_poiAttribute attrib; return_value._1 = m_searchResult.id; return_value._2 = m_searchResult.distance; return_value._3 = m_searchResult.route_status; @@ -1016,7 +1032,7 @@ public: { DBus_poiDetails::poiDetails_t details; std::vector<categoryId_t> categories; - std::vector<DBus_attribute::attribute_t> attributes; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; }; typedef ::DBus::Struct< ::DBus::Struct< uint32_t, std::string, ::DBus::Struct< double, double, int32_t > >, std::vector< uint32_t >, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > > > DBus_searchResultDetails_t; @@ -1024,7 +1040,7 @@ public: DBus_searchResultDetails(){ DBus_poiDetails details; - DBus_attribute attrib; + DBus_poiAttribute attrib; m_searchResultDetails.details = details.get(); m_searchResultDetails.categories.clear(); m_searchResultDetails.categories.push_back(0); //one element by default @@ -1056,7 +1072,7 @@ public: void setDBus(DBus_searchResultDetails_t value){ size_t index; DBus_poiDetails details; - DBus_attribute attrib; + DBus_poiAttribute attrib; details.setDBus(value._1); m_searchResultDetails.details = details.get(); @@ -1077,7 +1093,7 @@ public: DBus_searchResultDetails_t return_value; size_t index; DBus_poiDetails details; - DBus_attribute attrib; + DBus_poiAttribute attrib; details.set(m_searchResultDetails.details); return_value._1 = details.getDBus(); @@ -1110,13 +1126,13 @@ public: categoryId_t category; DBus_geoCoordinate3D::geoCoordinate3D_t location; ushort distance; - std::vector<DBus_attribute::attribute_t> attributes; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; }; typedef ::DBus::Struct< uint32_t, std::string, uint32_t, ::DBus::Struct< double, double, int32_t >, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > > > DBus_poiCAMDetails_t; DBus_poiCAMDetails(){ - DBus_attribute attrib; + DBus_poiAttribute attrib; DBus_geoCoordinate3D loc; m_poiCAMDetails.source_id = 0; @@ -1152,7 +1168,7 @@ public: void setDBus(DBus_poiCAMDetails_t value){ size_t index; DBus_geoCoordinate3D loc; - DBus_attribute attrib; + DBus_poiAttribute attrib; m_poiCAMDetails.source_id = value._1; m_poiCAMDetails.name = value._2; @@ -1172,7 +1188,7 @@ public: DBus_poiCAMDetails_t return_value; size_t index; DBus_geoCoordinate3D loc; - DBus_attribute attrib; + DBus_poiAttribute attrib; return_value._1 = m_poiCAMDetails.source_id; return_value._2 = m_poiCAMDetails.name; @@ -1452,5 +1468,88 @@ private: CAMcategoryUpdate_t m_CAMcategoryUpdate; }; +class DBus_PoiAddedDetails : DBus_dataFormatConverter // (s(ddi)a(uiv)) -->in this implementation, the variant data depends on the value of 'type' +{ +public: + struct PoiAddedDetails_t + { + std::string name; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< std::string, ::DBus::Struct< double, double, int32_t >, std::vector< ::DBus::Struct< uint32_t, int32_t, ::DBus::Variant > > > DBus_PoiAddedDetails_t; + + + DBus_PoiAddedDetails(){ + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + m_PoiAddedDetails.name = ""; + m_PoiAddedDetails.location = loc.get(); + m_PoiAddedDetails.attributes.clear(); + m_PoiAddedDetails.attributes.push_back(attrib.get()); //one element by default + } + + ~DBus_PoiAddedDetails(){} + + void set(PoiAddedDetails_t value){ + size_t index; + m_PoiAddedDetails.name = value.name; + m_PoiAddedDetails.location = value.location; + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_PoiAddedDetails.attributes.push_back(value.attributes.at(index)); + } + } + + PoiAddedDetails_t get(){ + return(m_PoiAddedDetails); + } + + void setDBus(DBus_PoiAddedDetails_t value){ + DBus_geoCoordinate3D loc; + size_t index; + DBus_poiAttribute attrib; + + m_PoiAddedDetails.name = value._1; + loc.setDBus(value._2); + m_PoiAddedDetails.location = loc.get(); + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value._3.size();index++) + { + attrib.setDBus(value._3.at(index)); + m_PoiAddedDetails.attributes.push_back(attrib.get()); + } + } + + DBus_PoiAddedDetails_t getDBus(){ + DBus_PoiAddedDetails_t return_value; + size_t index; + DBus_poiAttribute attrib; + DBus_geoCoordinate3D loc; + + return_value._1 = m_PoiAddedDetails.name; + + loc.set(m_PoiAddedDetails.location); + return_value._2 = loc.getDBus(); + + return_value._3.clear(); + for (index=0;index<m_PoiAddedDetails.attributes.size();index++) + { + attrib.set(m_PoiAddedDetails.attributes.at(index)); + return_value._3.push_back(attrib.getDBus()); + } + + return(return_value); + } + +private: + PoiAddedDetails_t m_PoiAddedDetails; +}; + #endif diff --git a/src/poi-service/poi-manager-server/poi-manager-server-stub.h b/src/poi-service/poi-manager-server/poi-manager-server-stub.h index e0c268c..7997a14 100644 --- a/src/poi-service/poi-manager-server/poi-manager-server-stub.h +++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.h @@ -36,9 +36,7 @@ #include "poi-common-data-model.h" using namespace std; -using namespace org; -using namespace genivi; -using namespace navigation; +using namespace org::genivi::navigation; using namespace poiservice; class sqlRequest @@ -58,15 +56,6 @@ public: OK } SQL_REQUEST_ERRORS; - #define ICON_WIDTH 32 - #define ICON_HEIGHT 37 - #define ICON_URL "../resource/file" - #define ICON_FORMAT "png" - #define POI_PROVIDER "OpenStreetMap" - #define POI_NAME "mySweetHome" - #define SEARCH_STRING "Sweet" - #define MEDIASET 1 - typedef uint32_t recordId_t; typedef uint32_t iconId_t; typedef uint32_t poiproviderId_t; @@ -192,7 +181,7 @@ private: }; -class PoiManagerServerStub: public org::genivi::navigation::poiservice::POIContentManagerStubDefault { +class PoiManagerServerStub: public POIContentManagerStubDefault { public: PoiManagerServerStub(); diff --git a/src/poi-service/poi-server/CMakeLists.txt b/src/poi-service/poi-server/CMakeLists.txt index 38cf342..ec16a44 100644 --- a/src/poi-service/poi-server/CMakeLists.txt +++ b/src/poi-service/poi-server/CMakeLists.txt @@ -60,8 +60,6 @@ link_directories( add_executable(poi-server main.cpp - poi-server-class.h - poi-datamodel.h ${PRJ_COMMON_SRCS} ) diff --git a/src/poi-service/poi-server/main.cpp b/src/poi-service/poi-server/main.cpp index 2717f0d..b581e74 100644 --- a/src/poi-service/poi-server/main.cpp +++ b/src/poi-service/poi-server/main.cpp @@ -1277,7 +1277,7 @@ void poiSearchServer::RequestResultList(const handleId_t& poiSearchHandle, const DBus_searchResult el; DBus_poiCAMDetails::poiCAMDetails_t camElement; //id name category location distance attributes[] DBus_poiCAMDetails camEl; - DBus_attribute::attribute_t attribute; //name type value + DBus_poiAttribute::poiAttribute_t attribute; //name type value uint16_t index,size,sub_index; size_t attribute_index; poi_t poi; @@ -1496,7 +1496,7 @@ std::vector< DBus_searchResultDetails::DBus_searchResultDetails_t > poiSearchSer std::vector< DBus_searchResultDetails::DBus_searchResultDetails_t > return_value; DBus_searchResultDetails searchResDet; DBus_searchResultDetails::searchResultDetails_t searchResDetails; - DBus_attribute::attribute_t attribute; + DBus_poiAttribute::poiAttribute_t attribute; uint16_t indexPOIList,indexIDList; size_t attribute_index; poi_t poi; diff --git a/src/poi-service/resource/poi-database-managed.db b/src/poi-service/resource/poi-database-managed.db Binary files differindex f7ad60b..ce25fc2 100644 --- a/src/poi-service/resource/poi-database-managed.db +++ b/src/poi-service/resource/poi-database-managed.db diff --git a/src/poi-service/run b/src/poi-service/run index bf47475..ca74661 100755 --- a/src/poi-service/run +++ b/src/poi-service/run @@ -30,6 +30,7 @@ CURDIR=$PWD BIN_DIR=$CURDIR/bin POI_SERVER_BIN_DIR=$BIN_DIR +POI_MANAGER_BIN_DIR=$BIN_DIR RESOURCE_DIR=$CURDIR/resource MAIN_DATABASE=$RESOURCE_DIR/poi-database-sample.db ADDITIONAL_DATABASE=$RESOURCE_DIR/poi-database-managed.db @@ -41,7 +42,7 @@ echo '------------------------start the server------------------------' $POI_SERVER_BIN_DIR/poi-server -f $MAIN_DATABASE & echo '------------------------start the manager server------------------------' -#$MANAGER_SERVER_EXE_DIR/poi-manager-server -f $ADDITIONAL_DATABASE & +#$POI_MANAGER_BIN_DIR/poi-manager-server -f $ADDITIONAL_DATABASE & diff --git a/test/poi-service/.gitignore b/test/poi-service/.gitignore index 5af3146..3454d1f 100644 --- a/test/poi-service/.gitignore +++ b/test/poi-service/.gitignore @@ -1,11 +1,10 @@ +positioning + #files *.qm *.odt# -*_adaptor.h -*_proxy.h -genivi-*.h *.user -Makefile + diff --git a/test/poi-service/CMakeLists.txt b/test/poi-service/CMakeLists.txt index 6579dfe..c54ee7d 100644 --- a/test/poi-service/CMakeLists.txt +++ b/test/poi-service/CMakeLists.txt @@ -17,6 +17,7 @@ ########################################################################### project(poi-service) cmake_minimum_required(VERSION 2.8) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") message(STATUS "poi-service") @@ -35,11 +36,11 @@ message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") set(API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api") set(DBUS_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/dbus-include") set(DBUS_GENERATED_INCLUDE_DIR_POSITIONING "${CMAKE_CURRENT_BINARY_DIR}/api") # this one is for positioning -set(COMMON_API_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api/franca/navigation/src-gen") set(POI_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../src") + set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/poi-common") set(COMMON_DIR_POI_SERVER "${POI_SRC_DIR}/poi-service/poi-common") -set(DBUS_LIB_PATH "/usr/local/lib") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) @@ -60,5 +61,7 @@ add_subdirectory(poi-client) add_subdirectory(poi-contentaccess-module) if (WITH_FRANCA_INTERFACE) - add_subdirectory(poi-manager-client) + set(COMMON_API_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api/franca/navigation/src-gen") + set(DBUS_LIB_PATH "/usr/local/lib") + add_subdirectory(poi-manager-client) endif() diff --git a/test/poi-service/lib/libgnss-service-use-replayer.so b/test/poi-service/lib/libgnss-service-use-replayer.so Binary files differdeleted file mode 100755 index 5984ec4..0000000 --- a/test/poi-service/lib/libgnss-service-use-replayer.so +++ /dev/null diff --git a/test/poi-service/lib/libsensors-service-use-replayer.so b/test/poi-service/lib/libsensors-service-use-replayer.so Binary files differdeleted file mode 100755 index 9d9800e..0000000 --- a/test/poi-service/lib/libsensors-service-use-replayer.so +++ /dev/null diff --git a/test/poi-service/poi-contentaccess-module/main.cpp b/test/poi-service/poi-contentaccess-module/main.cpp index 720d786..6d946c0 100644 --- a/test/poi-service/poi-contentaccess-module/main.cpp +++ b/test/poi-service/poi-contentaccess-module/main.cpp @@ -573,7 +573,7 @@ uint16_t contentAccessModuleServer::searchPOIRequest(uint16_t categoryIndex, std size_t index,sub_index,attribute_index; DBus_poiCAMDetails poiCAMDet; DBus_poiCAMDetails::poiCAMDetails_t poi; //source_id, name, category, location, distance, attributes - DBus_attribute::attribute_t poiAttrib; + DBus_poiAttribute::poiAttribute_t poiAttrib; DBus_searchResultDetails poiDet; DBus_searchResultDetails::searchResultDetails_t poiDetails; //details(unique id, name, lat, lon, alt), categories, attributes(name, type, value) std::string name; diff --git a/test/poi-service/poi-manager-client/CMakeLists.txt b/test/poi-service/poi-manager-client/CMakeLists.txt index b7fc9b5..08b21db 100644 --- a/test/poi-service/poi-manager-client/CMakeLists.txt +++ b/test/poi-service/poi-manager-client/CMakeLists.txt @@ -16,64 +16,65 @@ # @licence end@ ########################################################################### project(poi-manager-client) -set(PARENT_API poiservice) -set(ROOT_API navigation) set(COMMON_API_VERSION CommonAPI-2.1) set(CMAKE_VERBOSE_MAKEFILE off) cmake_minimum_required(VERSION 2.8) -set(CMAKE_CXX_FLAGS "-Wall -O0 -std=c++0x") -# DBus Path -if (DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) -else() - message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath") -endif() +message(STATUS "poi-manager-client") -# Packages find_package(PkgConfig REQUIRED) -pkg_check_modules(DBUS "dbus-1 >= 1.4") -pkg_check_modules(COMMONAPI "CommonAPI >= 2.1") -pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 2.1") -pkg_check_modules(SQLITE3 REQUIRED sqlite3) + +pkg_check_modules(DBUS_CPP dbus-c++-1) +pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GLIBMM glibmm-2.4) +pkg_check_modules(GOBJECT gobject-2.0) +pkg_check_modules(DBUS dbus-1) +pkg_check_modules(DBUS_CPP_GLIB dbus-c++-glib-1) +pkg_check_modules(GTK gtk+-3.0) -# Source Files -set(PRJ_SRC_PATH .) -set(PRJ_SRC_GEN_PATH ${COMMON_API_GENERATED_INCLUDE_DIR}/org/genivi) FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/${ROOT_API}/${PARENT_API}/*Stub*.cpp) -FILE(GLOB PRJ_STUB_GEN_TYPES ${PRJ_SRC_GEN_PATH}/${ROOT_API}/${PARENT_API}/*Types*.cpp ${PRJ_SRC_GEN_PATH}/${ROOT_API}/*Types*.cpp) -FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*stub*.cpp) -set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_GEN_TYPES} ${PRJ_STUB_IMPL_SRCS}) +set(PRJ_SRCS ${PRJ_LOCAL_SRCS}) include_directories( - ${PRJ_SRC_PATH} - ${COMMON_API_GENERATED_INCLUDE_DIR} - ${DBUS_INCLUDE_DIRS} - ${COMMONAPI_INCLUDEDIR}/${COMMON_API_VERSION} - ${COMMONAPI_DBUS_INCLUDEDIR} - ${GLIBMM_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${COMMON_DIR} + ${COMMON_DIR_POI_SERVER} + ${DBUS_GENERATED_INCLUDE_DIR}/poi-service + ${DBUS_CPP_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS} + ${GLIBMM_INCLUDE_DIRS} + ${GOBJECT_INCLUDE_DIRS} + ${DBUS_INCLUDE_DIRS} + ${DBUS_CPP_GLIB_INCLUDE_DIRS} + ${GTK_INCLUDE_DIRS} ) link_directories( - ${DBUS_LIB_PATH} - ${COMMONAPI_LIBDIR} - ${COMMONAPI_DBUS_LIBDIR} - ${GLIBMM_LIBRARY_DIRS} + ${DBUS_CPP_LIBRARY_DIRS} + ${GLIB_LIBRARY_DIRS} ${SQLITE3_LIBRARY_DIRS} + ${GLIBMM_LIBRARY_DIRS} + ${GOBJECT_LIBRARY_DIRS} + ${DBUS_LIBRARY_DIRS} + ${DBUS_CPP_GLIB_DIRS} + ${GTK_DIRS} +) + +add_executable(${PROJECT_NAME} + ${PRJ_SRCS} ) set(LIBRARIES - ${COMMONAPI_LIBRARIES} - ${COMMONAPI_DBUS_LIBRARIES} - ${GLIBMM_LIBRARIES} + ${DBUS_CPP_LIBRARIES} + ${GLIB_LIBRARIES} ${SQLITE3_LIBRARIES} + ${GLIBMM_LIBRARIES} + ${GOBJECT_LIBRARIES} + ${DBUS_LIBRARIES} + ${DBUS_CPP_GLIB_LIBRARIES} + ${GTK_LIBRARIES} ) -# Build service -add_executable(${PROJECT_NAME} ${PRJ_SRCS}) target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) - diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp index 19ffb69..186472e 100644 --- a/test/poi-service/poi-manager-client/main.cpp +++ b/test/poi-service/poi-manager-client/main.cpp @@ -24,32 +24,424 @@ * * @licence end@ */ + +#include <stdbool.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <sys/types.h> #include <iostream> -#include <thread> -#include <CommonAPI/CommonAPI.h> //Defined in the Common API Runtime library -#include "org/genivi/navigation/poiservice/POIContentManagerProxy.h" +#include <cmath> +#include <typeinfo> +#include <getopt.h> +#include <fstream> +#include <gtk/gtk.h> + + +#include "genivi-poiservice-contentmanager_proxy.h" +#include "genivi-poiservice-constants.h" + +#include <dbus-c++/glib-integration.h> + +#include "poi-common-dbus-data-model-new-variant.h" + +static const char* contentManager_OBJECT_PATH = "/org/genivi/poiservice/POIContentManager"; +static const char* contentManager_SERVICE_NAME = "org.genivi.poiservice.POIContentManager"; + +using namespace DBus; +using namespace std; +using namespace org::genivi::poiservice; + +// DBus instances +static DBus::Glib::BusDispatcher *dispatcher; +static DBus::Connection *dbusConnection; + +// class contentManager +class contentManager +: public org::genivi::poiservice::POIContentManager_proxy, + public DBus::IntrospectableProxy, + public DBus::ObjectProxy +{ + +public: + + contentManager(DBus::Connection &connection); + + ~contentManager(); + + void ConfigurationChanged(const std::vector< uint16_t >& changedSettings); + + void CategoriesRemoved(const std::vector< uint32_t >& categories); + + void POIAdded(const std::vector< uint32_t >& pois); + + void POIRemoved(const std::vector< uint32_t >& pois); -using namespace org::genivi::navigation::poiservice; + void connectPopupWindow(GtkWidget *window); -int main() + void testCreateCategory(); + + void testRemoveCategory(); + + void testCreatePOI(); + + void testRemovePOI(); + + void testSearch(); + +private: + + GtkWidget *mp_popupWindow; + DBus_CAMcategory m_category; + categoryId_t m_category_id; + poiId_t m_poi_id; + DBus_PoiAddedDetails m_poi; + DBus_geoCoordinate3D m_left_bottom_location,m_right_top_location; + std::string m_strTest; +}; + +static contentManager *clientContentManager; + +contentManager::contentManager(DBus::Connection &connection) + : DBus::ObjectProxy(connection, contentManager_OBJECT_PATH, contentManager_SERVICE_NAME) { - // Common API data init - std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load(); - std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory(); + DBus_poiAttribute::poiAttribute_t poi_attribute; + DBus_categoryAttribute::categoryAttribute_t category_attribute; + DBus_CAMcategory::CAMcategory_t category; + DBus_PoiAddedDetails::PoiAddedDetails_t poi; + DBus_geoCoordinate3D::geoCoordinate3D_t left_bottom_location,right_top_location; + + // init of data test for category + category = m_category.get(); + category.details.name = "recreation"; //new category + + category_attribute.id = ATTRIBUTE_PHONE; + category_attribute.name = "phone"; //existing attribute + category_attribute.type = GENIVI_POISERVICE_STRING; + category.attributes.push_back(category_attribute); + + category_attribute.id = ATTRIBUTE_CREDIT_CARD; //new attribute id + category_attribute.name = "credit card"; //new attribute + category_attribute.type = GENIVI_POISERVICE_STRING; + category.attributes.push_back(category_attribute); + + category.details.parents_id.push_back(0); + + m_category.set(category); + + // init of data test for poi + poi = m_poi.get(); + poi.name = POI_NAME; + + poi.location.altitude = 120; + poi.location.latitude = 48.779839; + poi.location.longitude = 2.217260; + + poi_attribute.id = ATTRIBUTE_ADDRCITY; + std::string vs(string("Velizy")); + poi_attribute.value.index = DBus_variantAttributeValue::AS_STRING; + poi_attribute.value.content.stringValue = vs; + poi.attributes.push_back(poi_attribute); + + poi_attribute.id = ATTRIBUTE_STARS; + std::string v("5"); + poi_attribute.value.index = DBus_variantAttributeValue::AS_STRING; + poi_attribute.value.content.stringValue = v; + poi.attributes.push_back(poi_attribute); - const std::string& serviceAddress = "local:org.genivi.poiservice.POIContentManager:org.genivi.poiservice.POIContentManager"; - std::shared_ptr<POIContentManagerProxyDefault> myProxy = factory->buildProxy<POIContentManagerProxy>(serviceAddress); + m_poi.set(poi); + // init of data test for location + left_bottom_location = m_left_bottom_location.get(); + right_top_location = m_right_top_location.get(); + left_bottom_location.latitude = 48.76; + left_bottom_location.longitude = 2.22; + right_top_location.latitude = 48.78; + right_top_location.longitude = 2.20; - while (!myProxy->isAvailable()) { - usleep(10); + m_left_bottom_location.set(left_bottom_location); + m_right_top_location.set(right_top_location); + + // initi of the data test for search string + m_strTest = SEARCH_STRING; + +} + +contentManager::~contentManager() +{ +} + +void contentManager::ConfigurationChanged(const std::vector< uint16_t >& changedSettings) +{ + size_t index; + + cout << "ConfigurationChanged"; + for(index=0;index<changedSettings.size();index++) + { + cout << changedSettings.at(index); } + cout << endl; +} + +void contentManager::CategoriesRemoved(const std::vector< uint32_t >& categories) +{ + size_t index; + + cout << "Categories Removed" << endl; + for(index=0;index<categories.size();index++) + { + cout << "Id: " << categories.at(index) << endl; + } +} +void contentManager::POIAdded(const std::vector< uint32_t >& pois) +{ + size_t index; - while (true) { - std::this_thread::sleep_for(std::chrono::seconds(5)); + cout << "POI Added" << endl; + for(index=0;index<pois.size();index++) + { + cout << "Id: " << pois.at(index) << endl; } +} + +void contentManager::POIRemoved(const std::vector< uint32_t >& pois) +{ + size_t index; + + cout << "POI Removed" << endl; + for(index=0;index<pois.size();index++) + { + cout << "Id: " << pois.at(index) << endl; + } +} + +void contentManager::connectPopupWindow(GtkWidget *window) +{ + mp_popupWindow = window; +} + +void contentManager::testCreateCategory() +{ + m_category_id = createCategory(m_category.getDBus()); + cout << "Category Created" << endl << "Id: " << m_category_id << endl; + +} + +void contentManager::testRemoveCategory() +{ + std::vector<categoryId_t> categories; + categories.push_back(m_category_id); + + removeCategories(categories); +} - return 0; +void contentManager::testCreatePOI() +{ + +} + +void contentManager::testRemovePOI() +{ + +} + +void contentManager::testSearch() +{ + std::vector<poiId_t> poi_id_list; + +} + +const char* program_name; //file to sink outputs + +/** + * \fn is_readable (const std::string & file) + * \brief Check if file can be opened. + * + * \param const std::string & file -name of the file + * \return true if file readable. + */ +bool is_readable( const std::string & file ) +{ + std::ifstream fi( file.c_str() ); + return !fi.fail(); +} + +static void popupMessage( GtkWidget *widget, + gpointer data ) +{ + g_print ("Message: %s \n", (gchar *) data); } +static gboolean deleteWindow( GtkWidget *widget, + GdkEvent *event, + gpointer data ) +{ + gtk_main_quit (); + g_print ("poi manager client closed\n"); + return FALSE; +} + +static void onCreateCategory( GtkWidget *widget, + contentManager *clientContentManager ) +{ + clientContentManager->testCreateCategory(); +} + +static void onDeleteCategory( GtkWidget *widget, + contentManager *clientContentManager ) +{ + clientContentManager->testRemoveCategory(); +} + +void populateWindow(GtkWidget *window,contentManager *clientContentManager) +{ + GtkWidget *button; + GtkWidget *box; + + gtk_window_set_title (GTK_WINDOW (window), "Poi Manager Client"); + + g_signal_connect (window, "delete-event", + G_CALLBACK (deleteWindow), NULL); + + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + + gtk_container_add (GTK_CONTAINER (window), box); + + button = gtk_button_new_with_label ("Create category"); + + g_signal_connect (button, "clicked", + G_CALLBACK (onCreateCategory), clientContentManager); + + gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0); + + gtk_widget_show (button); + + button = gtk_button_new_with_label ("Delete category"); + + g_signal_connect (button, "clicked", + G_CALLBACK (onDeleteCategory), clientContentManager); + + gtk_box_pack_start(GTK_BOX (box), button, TRUE, TRUE, 0); + + gtk_widget_show (button); + + gtk_widget_show (box); + + gtk_widget_show (window); +} + +/** + * \fn print_usage (FILE* stream, int exit_code) + * \brief Display the available options. + * + * \param const FILE* stream -name of stream to use + * \param int exit_code -exit code + * \return void. + */ +void print_usage (FILE* stream, int exit_code) +{ + fprintf (stream, "Use: %s options [database]\n",program_name); + fprintf (stream, + " -h --help Display this message.\n" + " -f --file database Open the database.\n" + " -t --test Test.\n"); + exit (exit_code); +} + +/** + * \fn int main (int argc , char** argv) + * \brief POI content manager implements the component of POI Service "POIContentManager" to add/remove poi. + * + * \param int argc + * \param char** argv + * \return EXIT_SUCCESS, EXIT_FAILURE. + */ +int main(int argc , char** argv ) +{ + GtkWidget *window; + + // Set the global C and C++ locale to the user-configured locale, + // so we can use std::cout with UTF-8, via Glib::ustring, without exceptions. + std::locale::global(std::locale("")); + + //index used for argument analysis + int next_option; + + /* Valid letters for short options. */ + const char* const short_options = "htf:"; + /* Valid string for long options. */ + const struct option long_options[] = { + { "help", 0, NULL, 'h' }, + { "test", 0, NULL, 't' }, + { "file", 2, NULL, 'f' }, + { NULL, 0, NULL, 0 } /* Always at the end of the table. */ + }; + char* database_filename = NULL; //database filename passed as first argument + program_name = argv[0]; + + do { + next_option = getopt_long (argc, argv, short_options, + long_options, NULL); + switch (next_option) + { + case 'h': /* -h --help */ + print_usage (stdout, 0); + break; + case 't': /* -t --test */ + // creating the dispatcher + dispatcher = new DBus::Glib::BusDispatcher(); + DBus::default_dispatcher = dispatcher; + dispatcher->attach(NULL); + + // create a connection on the session bus + dbusConnection = new DBus::Connection(DBus::Connection::SessionBus()); + dbusConnection->setup(dispatcher); + + // create a client for ContentManager + clientContentManager = new contentManager(*dbusConnection); + + // Create the interface panel + gtk_init (&argc, &argv); + + // Create a new window + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + // Connect the dbus client to the popup window (for feedback on signals) + clientContentManager->connectPopupWindow(window); + + // Populate the window and connect it to the dbus client (for commands) + populateWindow(window,clientContentManager); + + // Send a feedback to the user + cout << "poi manager client started" << endl; + + // loop listening + gtk_main(); + + break; + case 'f': /* -f --file database*/ + database_filename = argv[2]; + if (!is_readable(database_filename)) + print_usage (stderr, 1); + else + { + // Manage the database content + cout << "Not implemented yet" << endl; + } + break; + case '?': /* Invalid option. */ + print_usage (stderr, 1); + case -1: /* End of options. */ + break; + default: /* Error */ + print_usage (stderr, 1); + } + } + while (next_option != -1); + + return EXIT_SUCCESS; +} |