summaryrefslogtreecommitdiff
path: root/test/poi-service/poi-manager-client/main.cpp
blob: 6ace12079e018532b4119e8eaca089efd581ea1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2013-2015, PCA Peugeot Citroen
*
* \file main.cpp
*
* \brief This file is part of the poi proof of concept.
*
* \author Philippe Colliot <philippe.colliot@mpsa.com>
*
* \version 0.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:
* <date>, <name>, <description of change>
*
* @licence end@
*/

#include <stdbool.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <iostream>
#include <cmath>
#include <typeinfo>
#include <getopt.h>
#include <fstream>
#include <gtk/gtk.h>
#include <functional>

#include <CommonAPI/CommonAPI.hpp> //Defined in the Common API Runtime library
#include <CommonTypes.hpp>
#include <NavigationTypes.hpp>
#include <POIServiceTypes.hpp>
#include <POIContentAccessModuleProxy.hpp>

#include "poi-common-data-model.h"

using namespace std;
using namespace v2::org::genivi::navigation::poiservice;
using namespace v4::org::genivi::navigation;
using namespace v4::org::genivi;

// class  contentManager
class  contentManager
{

public:

    contentManager(std::shared_ptr<POIContentAccessModuleProxyDefault> proxy);

    ~contentManager();

    void getServerStatus();

    void configurationChanged(const std::vector<POIServiceTypes::Settings> &changedSettings);

    void categoriesRemoved(const std::vector< CommonTypes::CategoryID >& categories);

    void poiAdded(const std::vector< POIServiceTypes::POI_ID >& pois);

    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();

    void testRemoveCategory();

    void testCreatePOI();

    void testRemovePOI();

    void testSearch();

    void createCategory(const CommonTypes::CategoryID& category);

    void dumpCategories();

    void dumpLocales();

private:

    GtkWidget *mp_popupWindow;
    std::shared_ptr<POIContentAccessModuleProxyDefault> mp_proxy;
    POIServiceTypes::CAMCategory m_category;
    CommonTypes::CategoryID m_category_id;
    std::vector<CommonTypes::CategoryID> m_category_ids;
    std::vector<POIServiceTypes::POI_ID> m_poi_ids;
    POIServiceTypes::PoiAddedDetails m_poi;
    NavigationTypes::Locale m_locales;

    std::string m_strTest;
};

static contentManager *clientContentManager;

contentManager::contentManager(std::shared_ptr<POIContentAccessModuleProxyDefault> proxy)
{
    // test: create a new category, with a new attribute and add a poi under this category
    POIServiceTypes::Details categoryDetails;
    std::vector<CommonTypes::CategoryID> categoryParentsIDList;
    POIServiceTypes::Icon categoryIcons(std::string(ICON_URL));
    POIServiceTypes::Media categoryMedia(std::string(""));

    POIServiceTypes::CategoryAttribute categoryAttribute;
    POIServiceTypes::Operator categoryOperator;
    POIServiceTypes::AttributeValue categoryOperatorAttributeValue(int32_t(0));
    std::vector<POIServiceTypes::Operator> categoryOperatorList;

    std::vector<POIServiceTypes::CategoryAttribute> categoryAttributeList;

    POIServiceTypes::CategorySortOption categorySortOption;
    std::vector<POIServiceTypes::CategorySortOption> categorySortOptionList;

    POIServiceTypes::PoiAttribute poiAttribute;
    std::vector<POIServiceTypes::PoiAttribute> poiAttributeList;
    NavigationTypes::Coordinate3D location;

    mp_proxy = proxy;

    categoryParentsIDList.clear();
    categoryParentsIDList.push_back(PARENT_ID);
    categoryDetails.setParentsId(categoryParentsIDList);
    categoryDetails.setIcons(categoryIcons);
    categoryDetails.setName(NEW_CATEGORY_NAME);
    categoryDetails.setShortDesc("");
    categoryDetails.setMedia(categoryMedia);
    m_category.setDetails(categoryDetails);              //new category

    categoryAttributeList.clear();
    categoryAttribute.setId(ATTRIBUTE_PHONE);
    categoryAttribute.setName(ATTRIBUTE_PHONE_NAME);   //existing attribute
    categoryAttribute.setType(POIServiceTypes::AttributeType::INTEGER);
    categoryOperator.setName("");
    categoryOperator.setType(POIServiceTypes::OperatorType::EQUAL);
    categoryOperator.setValue(categoryOperatorAttributeValue);
    categoryOperatorList.push_back(categoryOperator);
    categoryAttribute.setOperators(categoryOperatorList);
    categoryAttributeList.push_back(categoryAttribute);    
    categoryAttribute.setId(ATTRIBUTE_CREDIT_CARD);      //new attribute id
    categoryAttribute.setName(ATTRIBUTE_CREDIT_CARD_NAME);  //new attribute
    categoryAttribute.setType(POIServiceTypes::AttributeType::INTEGER);
    categoryOperator.setName("");
    categoryOperator.setType(POIServiceTypes::OperatorType::EQUAL);
    categoryOperator.setValue(categoryOperatorAttributeValue);
    categoryOperatorList.push_back(categoryOperator);
    categoryAttribute.setOperators(categoryOperatorList);
    categoryAttributeList.push_back(categoryAttribute);
    m_category.setAttributeList(categoryAttributeList);

    categorySortOption.setId(POIServiceTypes::SortOption::SORT_DEFAULT);
    categorySortOption.setName("");
    categorySortOptionList.push_back(categorySortOption);
    m_category.setSortOptions(categorySortOptionList);

    m_poi.setName(POI_NAME);

    location.setLatitude(POI_LOCATION_LATITUDE);
    location.setLongitude(POI_LOCATION_LONGITUDE);
    location.setAltitude(POI_LOCATION_ALTITUDE);
    m_poi.setLocation(location);

    poiAttributeList.clear();
    poiAttribute.setId(ATTRIBUTE_ADDRCITY);
    poiAttribute.setType(POIServiceTypes::AttributeType::BOOLEAN);
    POIServiceTypes::AttributeValue vs(string(NEW_CITY_NAME));
    poiAttribute.setValue(vs);
    poiAttributeList.push_back(poiAttribute);
    poiAttribute.setId(ATTRIBUTE_STARS);
    poiAttribute.setType(POIServiceTypes::AttributeType::BOOLEAN);
    POIServiceTypes::AttributeValue v(NEW_STARS_VALUE);
    poiAttribute.setValue(v);
    poiAttributeList.push_back(poiAttribute);
    m_poi.setAttributeList(poiAttributeList);

    // init of the data test for search string
    m_strTest = SEARCH_STRING;

    m_category_id = INVALID_CATEGORY;

    m_locales.setLanguageCode(LANGUAGE_CODE);
    m_locales.setCountryCode(COUNTRY_CODE);
    m_locales.setScriptCode(SCRIPT_CODE);

    m_category_ids.clear(); //list empty for the moment

    m_poi_ids.clear(); //list empty for the moment

}

contentManager::~contentManager()
{
}

static void getVersionAsyncCallback(const CommonAPI::CallStatus& callStatus, const CommonTypes::Version& version)
{
    if (callStatus != CommonAPI::CallStatus::SUCCESS) {
        cout << "Remote getVersion failed with status: " << static_cast<std::underlying_type<CommonAPI::CallStatus>::type>(callStatus) << endl;
        return;
    }

    cout << "Version " << version.getVersionMajor() << "." << version.getVersionMinor() << "." << version.getVersionMicro() << endl;
    cout << "Date " << version.getDate() << endl;
}

void contentManager::getServerStatus()
{
    function<void(const CommonAPI::CallStatus&, const CommonTypes::Version&)> getVersion = getVersionAsyncCallback;
    CommonAPI::CallStatus callStatus;

    mp_proxy->getVersionAsync(getVersionAsyncCallback);

    dumpLocales();

    mp_proxy->setLocale(m_locales.getLanguageCode(),m_locales.getCountryCode(),m_locales.getScriptCode(),callStatus);

    cout << "Change locales" << endl;

    dumpLocales();

    dumpCategories();

}

void contentManager::configurationChanged(const std::vector< POIServiceTypes::Settings >& changedSettings)
{
    size_t index;

    cout << "Configuration changed:  ";
    for(index=0;index<changedSettings.size();index++)
    {
        cout << changedSettings.at(index);
        cout << endl;
    }
}

void contentManager::categoriesRemoved(const std::vector<CommonTypes::CategoryID> &categories)
{
    size_t index;

    for(index=0;index<categories.size();index++)
    {
        if (m_category_id == categories.at(index))
        {
            m_category_id = INVALID_CATEGORY;
            cout << "Category " << categories.at(index) << " removed" << endl;
        }
    }

    dumpCategories();
}

void contentManager::poiAdded(const std::vector<POIServiceTypes::POI_ID> &pois)
{
    size_t index;

    m_poi_ids.clear();
    for(index=0;index<pois.size();index++)
    {
        cout << "POI " << pois.at(index) << " added" << endl;
        m_poi_ids.push_back(pois.at(index));
    }
}

void contentManager::poiRemoved(const std::vector<POIServiceTypes::POI_ID> &pois)
{
    size_t index;

    for(index=0;index<pois.size();index++)
    {
        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;
}

static void createCategoryAsyncCallback(const CommonAPI::CallStatus& callStatus, const CommonTypes::CategoryID& categoryID)
{
    if (callStatus != CommonAPI::CallStatus::SUCCESS) {
        cout << "Remote createCategory failed with status: " << static_cast<std::underlying_type<CommonAPI::CallStatus>::type>(callStatus) << endl;
        return;
    }

    cout << "Category " << categoryID << " created" << endl;

    clientContentManager->createCategory(categoryID);

    clientContentManager->dumpCategories();
}

void contentManager::createCategory(const CommonTypes::CategoryID& category)
{
    m_category_id = category;
}

void contentManager::dumpCategories()
{
    std::vector<POIServiceTypes::CategoryAndName> categories;
    CommonAPI::CallStatus callStatus;
    size_t index;

    mp_proxy->getAvailableCategories(callStatus,categories);

    for(index=0;index<categories.size();index++)
    {
        cout << "id: " << categories.at(index).getUniqueId() << " name: " << categories.at(index).getName() << " top level: " << categories.at(index).getTopLevel() << endl;
    }
}

void contentManager::dumpLocales()
{
    std::string languageCode, countryCode, scriptCode;
    CommonAPI::CallStatus callStatus;

    mp_proxy->getLocale(callStatus,languageCode,countryCode,scriptCode);

    cout << "languageCode: " << languageCode << " " << "countryCode: " << countryCode << " " << "scriptCode: " << scriptCode << " " << endl;
}

void contentManager::testCreateCategory()
{
    function<void(const CommonAPI::CallStatus&, const CommonTypes::CategoryID&)> fcb = createCategoryAsyncCallback;

    mp_proxy->createCategoryAsync(m_category,createCategoryAsyncCallback);

}

void contentManager::testRemoveCategory()
{
    std::vector<CommonTypes::CategoryID> categories;
    CommonAPI::CallStatus status;

    categories.push_back(m_category_id);

    mp_proxy->removeCategories(categories,status);
}

void contentManager::testCreatePOI()
{
    std::vector<POIServiceTypes::PoiAddedDetails> poiList;
    CommonAPI::CallStatus status;

    poiList.push_back(m_poi);
    mp_proxy->addPOIs(m_category_id,poiList,status);
}

void contentManager::testRemovePOI()
{
    CommonAPI::CallStatus status;

    mp_proxy->removePOIs(m_poi_ids,status);
}

void contentManager::testSearch()
{
    NavigationTypes::Coordinate3D location;
    POIServiceTypes::AttributeDetails attributeDetails;
    std::vector<POIServiceTypes::AttributeDetails> poiAttributes;
    POIServiceTypes::CategoryAndRadius categoryAndRadius;
    std::vector<POIServiceTypes::CategoryAndRadius> poiCategories;
    CommonAPI::CallStatus status;

    location.setLatitude(SEARCH_CENTER_LOCATION_LATITUDE);
    location.setLongitude(SEARCH_CENTER_LOCATION_LONGITUDE);
    location.setAltitude(SEARCH_CENTER_LOCATION_ALTITUDE);

    poiCategories.clear();
    categoryAndRadius.setId(m_category_id);
    categoryAndRadius.setRadius(SEARCH_RADIUS);
    poiCategories.push_back(categoryAndRadius);

    attributeDetails.setId(ATTRIBUTE_ADDRCITY);
    attributeDetails.setCategoryId(m_category_id);
    attributeDetails.setType(POIServiceTypes::AttributeType::BOOLEAN);
    POIServiceTypes::AttributeValue v(NEW_STARS_VALUE);
    attributeDetails.setValue(v);
    attributeDetails.setOper(POIServiceTypes::OperatorType::EQUAL);
    attributeDetails.setMandatory(FALSE);

    poiAttributes.clear();
    poiAttributes.push_back(attributeDetails);

    mp_proxy->poiSearchStarted(SEARCH_HANDLE,SEARCH_MAX_SIZE,location,poiCategories,poiAttributes,SEARCH_STRING,POIServiceTypes::SortOption::ATTRIBUTE_CUSTOM,status);
}

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();
}

static void onCreatePoi( GtkWidget *widget,
                      contentManager *clientContentManager )
{
    clientContentManager->testCreatePOI();
}

static void onDeletePoi( GtkWidget *widget,
                      contentManager *clientContentManager )
{
    clientContentManager->testRemovePOI();
}

static void onSearch( GtkWidget *widget,
                      contentManager *clientContentManager )
{
    clientContentManager->testSearch();
}

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);

    button = gtk_button_new_with_label("Create POI");

    g_signal_connect(button, "clicked",
              G_CALLBACK(onCreatePoi), clientContentManager);

    gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);

    gtk_widget_show(button);

    button = gtk_button_new_with_label("Delete POI");

    g_signal_connect(button, "clicked",
              G_CALLBACK(onDeletePoi), clientContentManager);

    gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);

    gtk_widget_show(button);

    button = gtk_button_new_with_label("Search");

    g_signal_connect(button, "clicked",
              G_CALLBACK(onSearch), 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(""));

    std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();

    const std::string domain = "local";
    const std::string instance = "POIContentAccessModuleService";
    const std::string connection = "POIContentAccessModuleClient";

    std::shared_ptr<POIContentAccessModuleProxyDefault> myProxy =
            runtime->buildProxy<POIContentAccessModuleProxy>(domain,instance);

    while (!myProxy->isAvailable()) {
        usleep(10);
    }

    //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 */

            // create a client for ContentManager
            clientContentManager = new contentManager(myProxy);

            // Create the interface panel
            gtk_init(&argc, &argv);

            // Create a new window
            window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

            // Connect the client to the popup window (for feedback on signals)
            clientContentManager->connectPopupWindow(window);

            // Populate the window and connect it to the client (for commands)
            populateWindow(window,clientContentManager);

            // Connect the DBus signals
            myProxy->getCategoriesRemovedEvent().subscribe([&](const std::vector<CommonTypes::CategoryID>& categories) {
                clientContentManager->categoriesRemoved(categories);
            });
            myProxy->getConfigurationChangedEvent().subscribe([&](const std::vector< POIServiceTypes::Settings >& changedSettings) {
                clientContentManager->configurationChanged(changedSettings);
            });
            myProxy->getPoiAddedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) {
                clientContentManager->poiAdded(pois);
            });
            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;

            // Get server status
            clientContentManager->getServerStatus();

            // loop listening
            gtk_main();

            delete clientContentManager;

            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);
            break;
        case -1:    /* End of options.  */
            break;
        default:    /* Error  */
            print_usage(stderr, 1);
        }
    }
    while (next_option != -1);

    myProxy.reset();
    runtime.reset();

    return EXIT_SUCCESS;
}