Alexa Auto SDK  2.0.0
AddressBook.h
1 /*
2  * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef AACE_ADDRESS_BOOK_ADDRESS_BOOK_H
17 #define AACE_ADDRESS_BOOK_ADDRESS_BOOK_H
18 
21 #include <string>
22 #include <iostream>
23 
24 #include "AACE/Core/PlatformInterface.h"
25 
26 namespace aace {
27 namespace addressBook {
28 
29 class AddressBookEngineInterface;
30 
31 class AddressBook : public aace::core::PlatformInterface {
32 public:
33  virtual ~AddressBook();
34 
35  enum class AddressBookType {
36  // Contacts
37  CONTACT,
38 
39  // Navigation Address
40  NAVIGATION
41  };
42 
48  public:
49  virtual ~IAddressBookEntriesFactory() = default;
57  virtual bool addName( const std::string& entryId, const std::string& name ) = 0;
58 
67  virtual bool addName( const std::string& entryId, const std::string& firstName, const std::string& lastName ) = 0;
68 
78  virtual bool addName( const std::string& entryId, const std::string& firstName, const std::string& lastName, const std::string& nickname ) = 0;
79 
88  virtual bool addPhone( const std::string& entryId, const std::string& label, const std::string& number ) = 0;
89 
108  virtual bool addPostalAddress( const std::string& entryId,
109  const std::string& label,
110  const std::string& addressLine1,
111  const std::string& addressLine2,
112  const std::string& addressLine3,
113  const std::string& city,
114  const std::string& stateOrRegion,
115  const std::string& districtOrCounty,
116  const std::string& postalCode,
117  const std::string& country,
118  float latitudeInDegrees,
119  float longitudeInDegrees,
120  float accuracyInMeters ) = 0;
121  };
122 
131  bool addAddressBook( const std::string& addressBookSourceId, const std::string& name, AddressBookType type );
132 
139  bool removeAddressBook( const std::string& addressBookSourceId );
140 
150  virtual bool getEntries( const std::string& addressBookSourceId, std::weak_ptr<IAddressBookEntriesFactory> factory ) = 0;
151 
158  void setEngineInterface( std::shared_ptr<aace::addressBook::AddressBookEngineInterface> engineInterface );
159 
160 private:
161  std::shared_ptr<aace::addressBook::AddressBookEngineInterface> m_engineInterface;
162 };
163 
164 inline std::ostream& operator<<( std::ostream& stream, const AddressBook::AddressBookType& type ) {
165  switch( type ) {
166  case AddressBook::AddressBookType::CONTACT:
167  stream << "CONTACT";
168  break;
169  case AddressBook::AddressBookType::NAVIGATION:
170  stream << "NAVIGATION";
171  break;
172  }
173  return stream;
174 }
175 
176 } // aace::addressBook
177 } // aace
178 
179 #endif // AACE_ADDRESS_BOOK_ADDRESS_BOOK_H
Definition: PlatformInterface.h:29
Definition: AddressBook.h:26

Alexa Auto SDK 2.0.0 - Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0