summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author <philippe colliot>2015-08-04 11:57:45 +0200
committer <philippe colliot>2015-08-04 11:57:45 +0200
commit86c047d1c415e506069e222f621e8c13735f9c20 (patch)
tree3e5e61c96f42e71b387bf97bee3e29b3a45b0282
parent7408b8e55d16d8fd81acaa4ce08420c34385ee15 (diff)
downloadpoi-service-86c047d1c415e506069e222f621e8c13735f9c20.tar.gz
[POISERVICE] POI manager based on CommonAPI has been successfully tested
-rwxr-xr-xapi/franca/navigation/poiservice/POIContentManager.fidl4
-rw-r--r--src/poi-service/poi-common/poi-common-data-model.h2
-rw-r--r--src/poi-service/poi-manager-server/poi-manager-server-stub.cpp16
-rw-r--r--src/poi-service/resource/poi-database-managed.dbbin36864 -> 36864 bytes
-rw-r--r--test/poi-service/poi-manager-client/main.cpp28
5 files changed, 42 insertions, 8 deletions
diff --git a/api/franca/navigation/poiservice/POIContentManager.fidl b/api/franca/navigation/poiservice/POIContentManager.fidl
index a20e15e..d16a48a 100755
--- a/api/franca/navigation/poiservice/POIContentManager.fidl
+++ b/api/franca/navigation/poiservice/POIContentManager.fidl
@@ -242,7 +242,9 @@ interface POIContentManager {
<** @description : poi search unique handle.**>
Handle poiSearchHandle
<** @description : enum(INVALID,NOT_STARTED,SEARCHING,FINISHED, ... ).**>
- SearchStatusState statusValue
+ SearchStatusState statusValue
+ <** @description : List of pois that match the search (only valid if status is set to SEARCHING or FINISHED, by default empty list).**>
+ POI_ID[] pois
}
}
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 de68ffd..e3db5e4 100644
--- a/src/poi-service/poi-common/poi-common-data-model.h
+++ b/src/poi-service/poi-common/poi-common-data-model.h
@@ -123,7 +123,7 @@ typedef struct
#define SEARCH_CENTER_LOCATION_LATITUDE 48.76
#define SEARCH_CENTER_LOCATION_LONGITUDE 2.22
#define SEARCH_CENTER_LOCATION_ALTITUDE 100
-#define SEARCH_RADIUS 200 //in tens of meters
+#define SEARCH_RADIUS 300 //in tens of meters
#define SEARCH_STRING "Sweet"
#define LANGUAGE_CODE "fra"
diff --git a/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp b/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp
index b32d4b3..b8a04d7 100644
--- a/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp
+++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp
@@ -1189,6 +1189,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::searchPoi(const string &categoryName,
sqlQuery += search_string;
sqlQuery += "%');";
query_result = mp_database->query(sqlQuery.c_str());
+
// read the result of the query
if (query_result.size() == 0) //get the amount of poi searched
{
@@ -1404,6 +1405,8 @@ void PoiManagerServerStub::poiSearchStarted(const std::shared_ptr<CommonAPI::Cli
NavigationTypes::Coordinate3D leftBottomLocation, rightTopLocation;
std::vector<POIServiceTypes::POI_ID> poiIDList;
+ poiIDList.clear(); // by default no hints
+
//For the moment, just search for one category
categoryAndRadius = _poiCategories.at(0);
@@ -1419,7 +1422,7 @@ void PoiManagerServerStub::poiSearchStarted(const std::shared_ptr<CommonAPI::Cli
if (index>=m_availableCategoryTable.size())
{
//no id found, error to be sent
- fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::INVALID);
+ fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::INVALID,poiIDList);
return;
}
@@ -1434,18 +1437,21 @@ void PoiManagerServerStub::poiSearchStarted(const std::shared_ptr<CommonAPI::Cli
m_search_handle = _poiSearchHandle; //for the moment, only one handle is managed
- fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::SEARCHING);
-
mp_sqlRequest->searchPoi(categoryName,_inputString, leftBottomLocation, rightTopLocation, poiIDList);
- fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::FINISHED);
+ fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::FINISHED,poiIDList);
}
void PoiManagerServerStub::poiSearchCanceled(const std::shared_ptr<CommonAPI::ClientId> _client, ::org::genivi::navigation::NavigationTypes::Handle _poiSearchHandle, poiSearchCanceledReply_t _reply)
{
+ std::vector<POIServiceTypes::POI_ID> poiIDList;
+
m_search_handle = NO_HANDLE;
- fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::NOT_STARTED);
+
+ poiIDList.clear();
+
+ fireSearchStatusChangedEvent(_poiSearchHandle,POIServiceTypes::SearchStatusState::NOT_STARTED,poiIDList);
}
void PoiManagerServerStub::resultListRequested(const std::shared_ptr<CommonAPI::ClientId> _client, uint8_t _camId, ::org::genivi::navigation::NavigationTypes::Handle _poiSearchHandle, std::vector< ::v0_1::org::genivi::navigation::poiservice::POIServiceTypes::AttributeID> _attributes, resultListRequestedReply_t _reply)
diff --git a/src/poi-service/resource/poi-database-managed.db b/src/poi-service/resource/poi-database-managed.db
index ce25fc2..0e7b022 100644
--- a/src/poi-service/resource/poi-database-managed.db
+++ b/src/poi-service/resource/poi-database-managed.db
Binary files differ
diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp
index 8a5acbc..7d33680 100644
--- a/test/poi-service/poi-manager-client/main.cpp
+++ b/test/poi-service/poi-manager-client/main.cpp
@@ -70,6 +70,8 @@ public:
void POIRemoved(const std::vector< POIServiceTypes::POI_ID >& pois);
+ void SearchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector<POIServiceTypes::POI_ID> &pois);
+
void connectPopupWindow(GtkWidget *window);
void testCreateCategory();
@@ -278,11 +280,32 @@ void contentManager::POIRemoved(const std::vector<POIServiceTypes::POI_ID> &pois
for(index=0;index<pois.size();index++)
{
- cout << "POI " << pois.at(index) << "removed" << endl;
+ cout << "POI " << pois.at(index) << " removed" << endl;
}
}
+void contentManager::SearchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector<POIServiceTypes::POI_ID> &pois)
+{
+ size_t index;
+
+ if(handle == SEARCH_HANDLE)
+ {
+ cout << "Search state " << searchStatusState << endl;
+ if(searchStatusState == POIServiceTypes::SearchStatusState::FINISHED)
+ {
+ cout << "Result list size " << pois.size() << endl;
+ if(pois.size()>0)
+ {
+ for(index=0;index<pois.size();index++)
+ {
+ cout << "POI id " << pois.at(index) << endl;
+ }
+ }
+ }
+ }
+}
+
void contentManager::connectPopupWindow(GtkWidget *window)
{
mp_popupWindow = window;
@@ -616,6 +639,9 @@ int main(int argc , char** argv )
myProxy->getPOIRemovedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) {
clientContentManager->POIRemoved(pois);
});
+ myProxy->getSearchStatusChangedEvent().subscribe([&](const NavigationTypes::Handle handle, const POIServiceTypes::SearchStatusState searchStatusState, const std::vector< POIServiceTypes::POI_ID >& pois ) {
+ clientContentManager->SearchStatusChanged(handle,searchStatusState,pois);
+ });
// Send a feedback to the user
cout << "poi manager client started" << endl;