AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
DeviceCategory.h
Go to the documentation of this file.
1 /*
2  * Copyright 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 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_BLUETOOTH_DEVICECATEGORY_H_
16 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_BLUETOOTH_DEVICECATEGORY_H_
17 
18 #include <ostream>
19 #include <string>
20 
24 enum class DeviceCategory {
25  // the paired device belongs to peripheral family
27  // the paired device belongs to gadget family
28  GADGET,
29  // the paired device is a audio/video major class.
31  // the paired device is a telephony device.
32  PHONE,
33  // the paired device falls into none of the above category.
34  OTHER,
35  // the paired device has no information.
36  UNKNOWN
37 };
38 
45 inline std::string deviceCategoryToString(const DeviceCategory& category) {
46  switch (category) {
48  return "REMOTE_CONTROL";
50  return "GADGET";
52  return "AUDIO_VIDEO";
54  return "PHONE";
56  return "OTHER";
58  return "UNKNOWN";
59  }
60 
61  return "UNKNOWN";
62 }
63 
70 inline DeviceCategory stringToDeviceCategory(const std::string& category) {
71  if (category == "REMOTE_CONTROL") return DeviceCategory::REMOTE_CONTROL;
72  if (category == "GADGET") return DeviceCategory::GADGET;
73  if (category == "AUDIO_VIDEO") return DeviceCategory::AUDIO_VIDEO;
74  if (category == "PHONE") return DeviceCategory::PHONE;
75  if (category == "OTHER") return DeviceCategory::OTHER;
76  if (category == "UNKNOWN") return DeviceCategory::UNKNOWN;
77 
79 }
80 
88 inline std::ostream& operator<<(std::ostream& stream, const DeviceCategory category) {
89  return stream << deviceCategoryToString(category);
90 }
91 
92 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_BLUETOOTH_DEVICECATEGORY_H_
DeviceCategory stringToDeviceCategory(const std::string &category)
Definition: DeviceCategory.h:70
std::string deviceCategoryToString(const DeviceCategory &category)
Definition: DeviceCategory.h:45
DeviceCategory
Definition: DeviceCategory.h:24
std::ostream & operator<<(std::ostream &stream, const DeviceCategory category)
Definition: DeviceCategory.h:88

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0