1 // 2 // Copyright (C) 2015 Google, Inc. 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 // You may obtain a copy of the License at: 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #include "service/common/bluetooth/adapter_state.h" 18 19 namespace bluetooth { 20 AdapterStateToString(AdapterState state)21std::string AdapterStateToString(AdapterState state) { 22 switch (state) { 23 case ADAPTER_STATE_DISCONNECTED: 24 return "ADAPTER_STATE_DISCONNECTED"; 25 case ADAPTER_STATE_CONNECTING: 26 return "ADAPTER_STATE_CONNECTING"; 27 case ADAPTER_STATE_CONNECTED: 28 return "ADAPTER_STATE_CONNECTED"; 29 case ADAPTER_STATE_DISCONNECTING: 30 return "ADAPTER_STATE_DISCONNECTING"; 31 case ADAPTER_STATE_OFF: 32 return "ADAPTER_STATE_OFF"; 33 case ADAPTER_STATE_TURNING_ON: 34 return "ADAPTER_STATE_TURNING_ON"; 35 case ADAPTER_STATE_ON: 36 return "ADAPTER_STATE_ON"; 37 case ADAPTER_STATE_TURNING_OFF: 38 return "ADAPTER_STATE_TURNING_OFF"; 39 default: 40 return "unknown state"; 41 } 42 } 43 44 } // namespace bluetooth 45