From 50e0a961b0fab17a25cda14d7d056ffc6aea4038 Mon Sep 17 00:00:00 2001 From: Morteza Damavandpeyma Date: Thu, 19 Jan 2017 15:43:12 +0100 Subject: Rewrite PoC and test applications for FreeTextSearchService --- .../FreeTextSearchStubImpl.cpp | 418 +++++++++++---------- .../FreeTextSearchStubImpl.hpp | 94 +++-- src/freetextsearch-service/main.cpp | 61 +-- 3 files changed, 310 insertions(+), 263 deletions(-) (limited to 'src/freetextsearch-service') diff --git a/src/freetextsearch-service/FreeTextSearchStubImpl.cpp b/src/freetextsearch-service/FreeTextSearchStubImpl.cpp index 79a5c96..556ff94 100644 --- a/src/freetextsearch-service/FreeTextSearchStubImpl.cpp +++ b/src/freetextsearch-service/FreeTextSearchStubImpl.cpp @@ -1,213 +1,237 @@ /** -* @licence app begin@ -* SPDX-License-Identifier: MPL-2.0 -* -* \copyright Copyright (C) 2015, 2016 TomTom International B.V. -* \copyright Copyright (C) 2016, PCA Peugeot Citroen -* \author Peter Goedegebure (Peter.Goedegebure@tomtom.com) -* \author Philippe Colliot -* 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: -* , , -* -* @licence end@ -*/ + * @licence app begin@ + * SPDX-License-Identifier: MPL-2.0 + * + * \copyright Copyright (C) 2015, 2016 TomTom International B.V. + * \copyright Copyright (C) 2016, PCA Peugeot Citroen + * \author Peter Goedegebure (Peter.Goedegebure@tomtom.com) + * \author Philippe Colliot + * \author Morteza Damavandpeyma + * 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: + * , , + * + * @licence end@ + */ #include "FreeTextSearchStubImpl.hpp" NavigationTypes::Handle nextHandle = 1; -FreeTextSearchStubImpl::FreeTextSearchStubImpl() { -} - -FreeTextSearchStubImpl::~FreeTextSearchStubImpl() { -} +void FreeTextSearchStubImpl::getVersion( + const std::shared_ptr _client, + getVersionReply_t _reply) +{ + std::cout << "getVersion called." << std::endl; -void FreeTextSearchStubImpl::getVersion(const std::shared_ptr _client, - FreeTextSearch::RequestId _requestId, getVersionReply_t _reply) { - std::cout << "getVersion called." << std::endl; - - FreeTextSearch::RequestId responseId = _requestId; - CommonTypes::Version* version = new CommonTypes::Version(0, 1, 0, "today"); - _reply(responseId, *version); + CommonTypes::Version* version = new CommonTypes::Version(0, 1, 0, "today"); + _reply(*version); } -void FreeTextSearchStubImpl::ftsRequest(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - FreeTextSearch::FtsString _inputString, ::org::genivi::navigation::NavigationTypes::Coordinate2D _searchLocation, - FreeTextSearch::ShapeList _searchShapes, FreeTextSearch::PageSize _pageSize, - FreeTextSearch::SearchOptions _searchOptions, FreeTextSearch::FtsString _searchConditions, - FreeTextSearch::FuzzyLevel _fuzzyLevel, ftsRequestReply_t _reply) { - // TODO: introduce ftsRequestError value for OK. - FreeTextSearch::ftsRequestError error = FreeTextSearch::ftsRequestError::NoMoreFtsHandles; - - FreeTextSearch::RequestId responseId = _requestId; - - - // Note: No administration of freeTextSearchHandles, just increment a number. - NavigationTypes::Handle freeTextSearchHandle = nextHandle++; - _reply(error, responseId, freeTextSearchHandle); - - // Note: inputString is ignored, use fixed results. - // Note: searchLocation is ignored, use fixed results. - // TODO: introduce a value for 'not specified' for searchLocation (Coordinate2D). - // Note: searchShapes is ignored, use fixed results. - // Note: pageSize is ignored, use fixed size of 2. First page: 2 addresses (moreAvailable), 1 POI (no moreAvailable). - // Note: searchOptions is ignored, use fixed results. - // Note: searchConditions is ignored, use fixed results, - // Note: fuzzyLevel is ignored, used fixed results. - - FreeTextSearch::Addresses addresses; - FreeTextSearch::Address* addressPtr; - FreeTextSearch::FtsStringList* places; - FreeTextSearch::FtsStringList* postalCodes; - FreeTextSearch::StreetDetails* streetDetailsPtr; - - addressPtr = new FreeTextSearch::Address(); - NavigationTypes::LocationHandle locationHandle1 = 1234; - addressPtr->setLocationHandle(locationHandle1); - addressPtr->setCountryCode("NLD"); - addressPtr->setStateCode(""); - places = new FreeTextSearch::FtsStringList(); - places->push_back("Eindhoven"); - addressPtr->setPlaces(*places); - postalCodes = new FreeTextSearch::FtsStringList(); - postalCodes->push_back("5657 EB"); - addressPtr->setPostalCodes(*postalCodes); - streetDetailsPtr = new FreeTextSearch::StreetDetails(); - streetDetailsPtr->setStreetName("Luchthavenweg"); - streetDetailsPtr->setHouseNumber("48"); - streetDetailsPtr->setHouseNumberFromInput(""); - FreeTextSearch::AddressDetails addressDetails(*streetDetailsPtr); - addressPtr->setAddressDetails(addressDetails); - addressPtr->setMapCode("L2D.3Z"); - NavigationTypes::Coordinate2D* coordinate1 = new NavigationTypes::Coordinate2D(51.455664, 5.396336); - addressPtr->setCoordinate(*coordinate1); - addressPtr->setDistance(4566); - addressPtr->setScore(1000); - addressPtr->setFuzzyMatch(false); - addresses.push_back(*addressPtr); - - addressPtr = new FreeTextSearch::Address(); - NavigationTypes::LocationHandle locationHandle2 = 9876; - addressPtr->setLocationHandle(locationHandle2); - addressPtr->setCountryCode("NLD"); - addressPtr->setStateCode(""); - places = new FreeTextSearch::FtsStringList(); - places->push_back("'s Hertogenbosch"); - addressPtr->setPlaces(*places); - postalCodes = new FreeTextSearch::FtsStringList(); - postalCodes->push_back(""); - addressPtr->setPostalCodes(*postalCodes); - streetDetailsPtr = new FreeTextSearch::StreetDetails(); - streetDetailsPtr->setStreetName(""); - streetDetailsPtr->setHouseNumber(""); - streetDetailsPtr->setHouseNumberFromInput(""); - FreeTextSearch::AddressDetails addressDetails2(*streetDetailsPtr); - addressPtr->setAddressDetails(addressDetails2); - addressPtr->setMapCode(""); - NavigationTypes::Coordinate2D* coordinate2 = new NavigationTypes::Coordinate2D(52.434356, 17.555336); - addressPtr->setCoordinate(*coordinate2); - addressPtr->setDistance(196534); - addressPtr->setScore(578); - addressPtr->setFuzzyMatch(true); - addresses.push_back(*addressPtr); - - fireFtsResultAddressesSelective(responseId, addresses, true); - - FreeTextSearch::POIs pois; - FreeTextSearch::POI* poiPtr; - poiPtr = new FreeTextSearch::POI(); - NavigationTypes::LocationHandle locationHandle3 = 102934; - poiPtr->setLocationHandle(locationHandle3); - FreeTextSearch::POICategoryCode poiCategoryCode = 754; - poiPtr->setCategoryCode(poiCategoryCode); - FreeTextSearch::FtsStringList* brandNames; - brandNames = new FreeTextSearch::FtsStringList(); - brandNames->push_back("TomTom"); - brandNames->push_back("Bandit"); - poiPtr->setBrandNames(*brandNames); - poiPtr->setPoiName("TomTom Eindhoven"); - poiPtr->setAddress("Luchthavenweg 48, 5657 EB Eindhoven"); - places = new FreeTextSearch::FtsStringList(); - places->push_back("Eindhoven"); - poiPtr->setPlace(*places); - postalCodes = new FreeTextSearch::FtsStringList(); - postalCodes->push_back("5657 EB"); - poiPtr->setPostalCode(*postalCodes); - poiPtr->setMapCode("L2D.3Z"); - poiPtr->setCountryCode("NLD"); - poiPtr->setStateCode(""); - poiPtr->setTelephone("+31 40 84 44899"); - poiPtr->setCoordinate(*coordinate1); - pois.push_back(*poiPtr); - fireFtsResultPoisSelective(responseId, pois, false); - // TODO why is there no score for a POI? - - FreeTextSearch::FtsStatus ftsStatus = FreeTextSearch::FtsStatus::OK; - fireFtsDoneSelective(responseId, ftsStatus); +void FreeTextSearchStubImpl::ftsRequest( + const std::shared_ptr _client, + FreeTextSearch::FtsString _inputString, + NavigationTypes::Coordinate2D _searchLocation, + FreeTextSearch::ShapeList _searchShapes, FreeTextSearch::PageSize _pageSize, + FreeTextSearch::SearchOptions _searchOptions, + FreeTextSearch::FtsString _searchConditions, + FreeTextSearch::FuzzyLevel _fuzzyLevel, ftsRequestReply_t _reply) +{ + std::cout << "ftsRequest called." << std::endl; + iSearchIsInProgress = true; + + // Create new session handle. + iSessionHandle++; + + // Start from first page + iPageId = 0; + + _reply(FreeTextSearch::ftsRequestError::OK, iSessionHandle, iPageId); + + // Note: inputString is ignored, use fixed results. + // Note: searchLocation is ignored, use fixed results. + // TODO: introduce a value for 'not specified' for searchLocation (Coordinate2D). + // Note: searchShapes is ignored, use fixed results. + // Note: pageSize is ignored, use fixed size of 2. First page: 2 addresses (moreAvailable), 1 POI (no moreAvailable). + // Note: searchOptions is ignored, use fixed results. + // Note: searchConditions is ignored, use fixed results, + // Note: fuzzyLevel is ignored, used fixed results. + + FreeTextSearch::Addresses addresses; + FreeTextSearch::Address* addressPtr; + FreeTextSearch::FtsStringList* places; + FreeTextSearch::FtsStringList* postalCodes; + FreeTextSearch::StreetDetails* streetDetailsPtr; + + addressPtr = new FreeTextSearch::Address(); + NavigationTypes::LocationHandle locationHandle1 = 1234; + addressPtr->setLocationHandle(locationHandle1); + addressPtr->setCountryCode("NLD"); + addressPtr->setStateCode(""); + places = new FreeTextSearch::FtsStringList(); + places->push_back("Eindhoven"); + addressPtr->setPlaces(*places); + postalCodes = new FreeTextSearch::FtsStringList(); + postalCodes->push_back("5657 EB"); + addressPtr->setPostalCodes(*postalCodes); + streetDetailsPtr = new FreeTextSearch::StreetDetails(); + streetDetailsPtr->setStreetName("Luchthavenweg"); + streetDetailsPtr->setHouseNumber("48"); + streetDetailsPtr->setHouseNumberFromInput(""); + FreeTextSearch::AddressDetails addressDetails(*streetDetailsPtr); + addressPtr->setAddressDetails(addressDetails); + addressPtr->setMapCode("L2D.3Z"); + NavigationTypes::Coordinate2D* coordinate1 = new NavigationTypes::Coordinate2D(51.455664, 5.396336); + addressPtr->setCoordinate(*coordinate1); + addressPtr->setDistance(4566); + addressPtr->setScore(1000); + addressPtr->setFuzzyMatch(false); + addresses.push_back(*addressPtr); + + addressPtr = new FreeTextSearch::Address(); + NavigationTypes::LocationHandle locationHandle2 = 9876; + addressPtr->setLocationHandle(locationHandle2); + addressPtr->setCountryCode("NLD"); + addressPtr->setStateCode(""); + places = new FreeTextSearch::FtsStringList(); + places->push_back("'s Hertogenbosch"); + addressPtr->setPlaces(*places); + postalCodes = new FreeTextSearch::FtsStringList(); + postalCodes->push_back(""); + addressPtr->setPostalCodes(*postalCodes); + streetDetailsPtr = new FreeTextSearch::StreetDetails(); + streetDetailsPtr->setStreetName(""); + streetDetailsPtr->setHouseNumber(""); + streetDetailsPtr->setHouseNumberFromInput(""); + FreeTextSearch::AddressDetails addressDetails2(*streetDetailsPtr); + addressPtr->setAddressDetails(addressDetails2); + addressPtr->setMapCode(""); + NavigationTypes::Coordinate2D* coordinate2 = new NavigationTypes::Coordinate2D(52.434356, 17.555336); + addressPtr->setCoordinate(*coordinate2); + addressPtr->setDistance(196534); + addressPtr->setScore(578); + addressPtr->setFuzzyMatch(true); + addresses.push_back(*addressPtr); + + fireFtsResultAddressesSelective(iSessionHandle, iPageId, addresses, true); + + FreeTextSearch::POIs pois; + FreeTextSearch::POI* poiPtr; + poiPtr = new FreeTextSearch::POI(); + NavigationTypes::LocationHandle locationHandle3 = 102934; + poiPtr->setLocationHandle(locationHandle3); + FreeTextSearch::POICategoryCode poiCategoryCode = 754; + poiPtr->setCategoryCode(poiCategoryCode); + FreeTextSearch::FtsStringList* brandNames; + brandNames = new FreeTextSearch::FtsStringList(); + brandNames->push_back("TomTom"); + brandNames->push_back("Bandit"); + poiPtr->setBrandNames(*brandNames); + poiPtr->setPoiName("TomTom Eindhoven"); + poiPtr->setAddress("Luchthavenweg 48, 5657 EB Eindhoven"); + places = new FreeTextSearch::FtsStringList(); + places->push_back("Eindhoven"); + poiPtr->setPlace(*places); + postalCodes = new FreeTextSearch::FtsStringList(); + postalCodes->push_back("5657 EB"); + poiPtr->setPostalCode(*postalCodes); + poiPtr->setMapCode("L2D.3Z"); + poiPtr->setCountryCode("NLD"); + poiPtr->setStateCode(""); + poiPtr->setTelephone("+31 40 84 44899"); + poiPtr->setCoordinate(*coordinate1); + poiPtr->setDistance(1000); + poiPtr->setScore(1); + poiPtr->setFuzzyMatch(false); + poiPtr->setHasParents(false); + poiPtr->setHasChildren(false); + poiPtr->setDetourDistance(100); + poiPtr->setDetourTime(200); + + pois.push_back(*poiPtr); + fireFtsResultPoisSelective(iSessionHandle, iPageId, pois, false); + + FreeTextSearch::POICategories poiCategories; + fireFtsResultPoiSuggestionsSelective(iSessionHandle, iPageId, poiCategories); + + fireFtsDoneSelective(iSessionHandle, iPageId, FreeTextSearch::FtsStatus::OK); + iSearchIsInProgress = false; } -void FreeTextSearchStubImpl::ftsNextPage(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - NavigationTypes::Handle _freeTextSearchHandle, FreeTextSearch::SearchOptions _searchOptions, - ftsNextPageReply_t _reply) { - // Note: No administration of freeTextSearchHandles, parameter is ignored. - // Note: searchOptions are ignored; always 1 address returned. - FreeTextSearch::RequestId responseId = _requestId; - - _reply(responseId); - - FreeTextSearch::FtsStatus ftsStatus = FreeTextSearch::FtsStatus::OK; - - FreeTextSearch::Addresses addresses; - FreeTextSearch::Address* addressPtr; - addressPtr = new FreeTextSearch::Address(); - NavigationTypes::LocationHandle locationHandle = 74658; - addressPtr->setLocationHandle(locationHandle); - addressPtr->setCountryCode("NLD"); - addressPtr->setStateCode(""); - FreeTextSearch::FtsStringList* places; - places = new FreeTextSearch::FtsStringList(); - places->push_back("Amsterdam"); - addressPtr->setPlaces(*places); - FreeTextSearch::FtsStringList* postalCodes; - postalCodes = new FreeTextSearch::FtsStringList(); - postalCodes->push_back(""); - addressPtr->setPostalCodes(*postalCodes); - addressPtr->setMapCode(""); - FreeTextSearch::StreetDetails* streetDetailsPtr; - streetDetailsPtr = new FreeTextSearch::StreetDetails(); - streetDetailsPtr->setStreetName(""); - streetDetailsPtr->setHouseNumber(""); - streetDetailsPtr->setHouseNumberFromInput(""); - FreeTextSearch::AddressDetails addressDetails(*streetDetailsPtr); - addressPtr->setAddressDetails(addressDetails); - NavigationTypes::Coordinate2D* coordinate = new NavigationTypes::Coordinate2D(50.123456, 9.838374); - addressPtr->setCoordinate(*coordinate); - addressPtr->setDistance(3009); - addressPtr->setScore(33); - addressPtr->setFuzzyMatch(false); - addresses.push_back(*addressPtr); - fireFtsResultAddressesSelective(responseId, addresses, false); - - fireFtsDoneSelective(responseId, ftsStatus); +void FreeTextSearchStubImpl::ftsNextPage( + const std::shared_ptr _client, + NavigationTypes::Handle _sessionHandle, + FreeTextSearch::SearchOptions _searchOptions, ftsNextPageReply_t _reply) +{ + std::cout << "ftsNextPage called." << std::endl; + if (iSearchIsInProgress) + { + std::cout << "There is a search in progress" << std::endl; + _reply(FreeTextSearch::ftsNextPageError::Literal::AlreadyInProgress, -1); + return; + } + + iSearchIsInProgress = true; + // Note: searchOptions are ignored; always 1 address returned. + + // Get the next page. + iPageId++; + _reply(FreeTextSearch::ftsNextPageError::Literal::OK, iPageId); + + FreeTextSearch::Addresses addresses; + FreeTextSearch::Address* addressPtr; + addressPtr = new FreeTextSearch::Address(); + NavigationTypes::LocationHandle locationHandle = 74658; + addressPtr->setLocationHandle(locationHandle); + addressPtr->setCountryCode("NLD"); + addressPtr->setStateCode(""); + FreeTextSearch::FtsStringList* places; + places = new FreeTextSearch::FtsStringList(); + places->push_back("Amsterdam"); + addressPtr->setPlaces(*places); + FreeTextSearch::FtsStringList* postalCodes; + postalCodes = new FreeTextSearch::FtsStringList(); + postalCodes->push_back(""); + addressPtr->setPostalCodes(*postalCodes); + addressPtr->setMapCode(""); + FreeTextSearch::StreetDetails* streetDetailsPtr; + streetDetailsPtr = new FreeTextSearch::StreetDetails(); + streetDetailsPtr->setStreetName(""); + streetDetailsPtr->setHouseNumber(""); + streetDetailsPtr->setHouseNumberFromInput(""); + FreeTextSearch::AddressDetails addressDetails(*streetDetailsPtr); + addressPtr->setAddressDetails(addressDetails); + NavigationTypes::Coordinate2D* coordinate = new NavigationTypes::Coordinate2D(50.123456, 9.838374); + addressPtr->setCoordinate(*coordinate); + addressPtr->setDistance(3009); + addressPtr->setScore(33); + addressPtr->setFuzzyMatch(false); + addresses.push_back(*addressPtr); + fireFtsResultAddressesSelective(iSessionHandle, iPageId, addresses, false); + + fireFtsDoneSelective(iSessionHandle, iPageId, FreeTextSearch::FtsStatus::OK); + iSearchIsInProgress = false; } -void FreeTextSearchStubImpl::ftsCancel(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - NavigationTypes::Handle _freeTextSearchHandle, ftsCancelReply_t _reply) { - FreeTextSearch::RequestId responseId = _requestId; - - _reply(responseId); +void FreeTextSearchStubImpl::ftsCancel( + const std::shared_ptr _client, + NavigationTypes::Handle _sessionHandle, ftsCancelReply_t _reply) +{ + std::cout << "ftsCancel called." << std::endl; + _reply(FreeTextSearch::ftsCancelError::Literal::OK); } -void FreeTextSearchStubImpl::deleteLocationHandles(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - FreeTextSearch::LocationHandleList _locationHandleList, deleteLocationHandlesReply_t _reply) { - FreeTextSearch::RequestId responseId = _requestId; - - _reply(responseId); +void FreeTextSearchStubImpl::deleteLocationHandles( + const std::shared_ptr _client, + FreeTextSearch::LocationHandleList _locationHandleList, + deleteLocationHandlesReply_t _reply) +{ + std::cout << "deleteLocationHandles called." << std::endl; + _reply(); } diff --git a/src/freetextsearch-service/FreeTextSearchStubImpl.hpp b/src/freetextsearch-service/FreeTextSearchStubImpl.hpp index 2f793dd..a6fbce3 100644 --- a/src/freetextsearch-service/FreeTextSearchStubImpl.hpp +++ b/src/freetextsearch-service/FreeTextSearchStubImpl.hpp @@ -1,54 +1,70 @@ /** -* @licence app begin@ -* SPDX-License-Identifier: MPL-2.0 -* -* \copyright Copyright (C) 2015, 2016 TomTom International B.V. -* \copyright Copyright (C) 2016, PCA Peugeot Citroen -* \author Peter Goedegebure (Peter.Goedegebure@tomtom.com) -* \author Philippe Colliot -* 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: -* , , -* -* @licence end@ -*/ + * @licence app begin@ + * SPDX-License-Identifier: MPL-2.0 + * + * \copyright Copyright (C) 2015, 2016 TomTom International B.V. + * \copyright Copyright (C) 2016, PCA Peugeot Citroen + * \author Peter Goedegebure (Peter.Goedegebure@tomtom.com) + * \author Philippe Colliot + * \author Morteza Damavandpeyma + * 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: + * , , + * + * @licence end@ + */ + #ifndef FREETEXTSEARCHSTUBIMPL_H_ #define FREETEXTSEARCHSTUBIMPL_H_ #include -#include -#include +#include +#include #include #include using namespace v0::org::genivi::navigation::freetextsearchservice; -using namespace org::genivi::navigation; -using namespace org::genivi; +using namespace v4::org::genivi::navigation; +using namespace v4::org::genivi; -class FreeTextSearchStubImpl: public FreeTextSearchStubDefault { +class FreeTextSearchStubImpl: public FreeTextSearchStubDefault +{ public: - FreeTextSearchStubImpl(); - ~FreeTextSearchStubImpl(); - void getVersion(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, getVersionReply_t _reply); - void ftsRequest(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - FreeTextSearch::FtsString _inputString, ::org::genivi::navigation::NavigationTypes::Coordinate2D _searchLocation, - FreeTextSearch::ShapeList _searchShapes, FreeTextSearch::PageSize _pageSize, - FreeTextSearch::SearchOptions _searchOptions, FreeTextSearch::FtsString _searchConditions, - FreeTextSearch::FuzzyLevel _fuzzyLevel, ftsRequestReply_t _reply); - void ftsNextPage(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - NavigationTypes::Handle _freeTextSearchHandle, FreeTextSearch::SearchOptions _searchOptions, - ftsNextPageReply_t _reply); - void ftsCancel(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - NavigationTypes::Handle _freeTextSearchHandle, ftsCancelReply_t _reply); - void deleteLocationHandles(const std::shared_ptr _client, FreeTextSearch::RequestId _requestId, - FreeTextSearch::LocationHandleList _locationHandleList, deleteLocationHandlesReply_t _reply); + void getVersion(const std::shared_ptr _client, + getVersionReply_t _reply) override; + + void ftsRequest(const std::shared_ptr _client, + FreeTextSearch::FtsString _inputString, + NavigationTypes::Coordinate2D _searchLocation, + FreeTextSearch::ShapeList _searchShapes, + FreeTextSearch::PageSize _pageSize, + FreeTextSearch::SearchOptions _searchOptions, + FreeTextSearch::FtsString _searchConditions, + FreeTextSearch::FuzzyLevel _fuzzyLevel, ftsRequestReply_t _reply) + override; + + void ftsNextPage(const std::shared_ptr _client, + NavigationTypes::Handle _sessionHandle, + FreeTextSearch::SearchOptions _searchOptions, ftsNextPageReply_t _reply) + override; + + void ftsCancel(const std::shared_ptr _client, + NavigationTypes::Handle _sessionHandle, ftsCancelReply_t _reply) override; + + void deleteLocationHandles(const std::shared_ptr _client, + FreeTextSearch::LocationHandleList _locationHandleList, + deleteLocationHandlesReply_t _reply) override; +private: + NavigationTypes::Handle iSessionHandle = 0; + FreeTextSearch::PageId iPageId = 0; + bool iSearchIsInProgress = false; }; diff --git a/src/freetextsearch-service/main.cpp b/src/freetextsearch-service/main.cpp index 34aff3e..a5c7112 100644 --- a/src/freetextsearch-service/main.cpp +++ b/src/freetextsearch-service/main.cpp @@ -1,9 +1,24 @@ -/* Copyright (C) 2015, 2016 TomTom International B.V. - * Author: Peter Goedegebure (Peter.Goedegebure@tomtom.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, 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/. - */ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2015, 2016 TomTom International B.V. +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* \author Peter Goedegebure (Peter.Goedegebure@tomtom.com) +* \author Philippe Colliot +* \author Morteza Damavandpeyma +* 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: +* , , +* +* @licence end@ +*/ #include #include @@ -11,27 +26,19 @@ #include #include "FreeTextSearchStubImpl.hpp" -int main() { - CommonAPI::Runtime::setProperty("LogContext", "FTSS"); - CommonAPI::Runtime::setProperty("LibraryBase", "FreeTextSearch"); +int main() +{ + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + std::shared_ptr myService = std::make_shared(); + runtime->registerService("local", "test", myService); + std::cout << "Successfully Registered FTS Service!" << std::endl; - std::shared_ptr runtime = CommonAPI::Runtime::get(); + while (true) + { + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(2)); + } - std::string domain = "local"; - std::string instance = "org.genivi.navigation.freetextsearchservice"; - - std::shared_ptr myService = std::make_shared(); - while (!runtime->registerService(domain, instance, myService, "service-sample")) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - - std::cout << "Successfully Registered Service!" << std::endl; - - while (true) { -// myService->incCounter(); // Change value of attribute, see stub implementation - std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; - std::this_thread::sleep_for(std::chrono::seconds(2)); - } - - return 0; + return 0; } + -- cgit v1.2.1