Alexa Auto SDK  2.3.0
AddressBook.h
1 /*
2  * Copyright 2019-2020 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(
79  const std::string& entryId,
80  const std::string& firstName,
81  const std::string& lastName,
82  const std::string& nickname) = 0;
83 
92  virtual bool addPhone(const std::string& entryId, const std::string& label, const std::string& number) = 0;
93 
112  virtual bool addPostalAddress(
113  const std::string& entryId,
114  const std::string& label,
115  const std::string& addressLine1,
116  const std::string& addressLine2,
117  const std::string& addressLine3,
118  const std::string& city,
119  const std::string& stateOrRegion,
120  const std::string& districtOrCounty,
121  const std::string& postalCode,
122  const std::string& country,
123  float latitudeInDegrees,
124  float longitudeInDegrees,
125  float accuracyInMeters) = 0;
126  };
127 
136  bool addAddressBook(const std::string& addressBookSourceId, const std::string& name, AddressBookType type);
137 
144  bool removeAddressBook(const std::string& addressBookSourceId);
145 
155  virtual bool getEntries(
156  const std::string& addressBookSourceId,
157  std::weak_ptr<IAddressBookEntriesFactory> factory) = 0;
158 
165  void setEngineInterface(std::shared_ptr<aace::addressBook::AddressBookEngineInterface> engineInterface);
166 
167 private:
168  std::shared_ptr<aace::addressBook::AddressBookEngineInterface> m_engineInterface;
169 };
170 
171 inline std::ostream& operator<<(std::ostream& stream, const AddressBook::AddressBookType& type) {
172  switch (type) {
173  case AddressBook::AddressBookType::CONTACT:
174  stream << "CONTACT";
175  break;
176  case AddressBook::AddressBookType::NAVIGATION:
177  stream << "NAVIGATION";
178  break;
179  }
180  return stream;
181 }
182 
183 } // namespace addressBook
184 } // namespace aace
185 
186 #endif // AACE_ADDRESS_BOOK_ADDRESS_BOOK_H
Definition: PlatformInterface.h:29
Definition: AddressBook.h:26

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