1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef USB_FUNCTION_MANAGER_H 17 #define USB_FUNCTION_MANAGER_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 #include "usb_common.h" 23 24 namespace OHOS { 25 namespace USB { 26 class UsbFunctionManager { 27 public: 28 static bool AreSettableFunctions(int32_t funcs); 29 30 static int32_t FromStringFunctions(std::string funcs); 31 static std::string ToStringFunctions(int32_t func); 32 static void updateFunctions(int32_t func); 33 static int32_t getCurrentFunctions(); 34 35 static const std::string FUNCTION_NAME_NONE; 36 static const std::string FUNCTION_NAME_HDC; 37 static const std::string FUNCTION_NAME_ACM; 38 static const std::string FUNCTION_NAME_ECM; 39 40 static const int32_t FUNCTION_NONE; 41 static const int32_t FUNCTION_ACM; 42 static const int32_t FUNCTION_ECM; 43 static const int32_t FUNCTION_HDC; 44 45 private: 46 static const int32_t FUNCTION_SETTABLE; 47 static const std::map<std::string, int32_t> FUNCTION_MAPPING_N2C; 48 static int32_t currentFunctions; 49 }; 50 } // namespace USB 51 } // namespace OHOS 52 53 #endif // USB_FUNCTION_MANAGER_H 54