1 /* 2 * Copyright (c) 2023 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 #ifndef AUDIO_PNP_PARAM 16 #define AUDIO_PNP_PARAM 17 18 #define ADD_DEVICE_HEADSET '1' 19 #define ADD_DEVICE_HEADSET_WITHOUT_MIC '2' 20 #define ADD_DEVICE_ADAPTER '4' 21 #define ADD_DEVICE_MIC_BLOCKED '5' 22 #define ADD_DEVICE_MIC_UN_BLOCKED '6' 23 #define AUDIO_EVENT_INFO_LEN_MAX 256 24 #define AUDIO_PNP_INFO_LEN_MAX 256 25 #define AUDIO_DEVICE_WAIT_USB_EVENT_UPDATE 100 26 27 #define INPUT_EVT_MAX_CNT 4 28 #define MOVE_NUM 16 29 #define REMOVE_AUDIO_DEVICE '0' 30 #define SWITCH_STATE_PATH "/sys/class/switch/h2w/state" 31 #define STATE_PATH_ITEM_SIZE 1 32 33 #define STATE_NOT_SUPPORTED 0 34 #define STATE_NN_OFF 1 35 #define STATE_NN_ON 2 36 37 #define UEVENT_ACTION "ACTION=" 38 #define UEVENT_NAME "NAME=" 39 #define UEVENT_STATE "STATE=" 40 #define UEVENT_DEV_NAME "DEVNAME=" 41 #define UEVENT_DEVTYPE "DEVTYPE=" 42 #define UEVENT_SUBSYSTEM "SUBSYSTEM=" 43 #define UEVENT_SWITCH_NAME "SWITCH_NAME=" 44 #define UEVENT_SWITCH_STATE "SWITCH_STATE=" 45 #define UEVENT_HDI_NAME "HID_NAME=" 46 #define UEVENT_ANAHS "ANAHS=" 47 #define UEVENT_ACTION_CHANGE "change" 48 #define UEVENT_TYPE_EXTCON "extcon3" 49 #define UEVENT_NAME_HEADSET "headset" 50 #define UEVENT_STATE_ANALOG_HS0 "MICROPHONE=0" 51 #define UEVENT_STATE_ANALOG_HS1 "MICROPHONE=1" 52 #define UEVENT_SUBSYSTEM_SWITCH "switch" 53 #define UEVENT_SWITCH_NAME_H2W "h2w" 54 #define UEVENT_SOCKET_BUFF_SIZE (64 * 1024) 55 #define UEVENT_SOCKET_GROUPS 0xffffffff 56 #define UEVENT_MSG_LEN 2048 57 #define UEVENT_ID_MODEL "ID_MODEL=" 58 #define UEVENT_PLATFORM "platform" 59 #define UEVENT_INSERT "INSERT" 60 #define UEVENT_REMOVE "REMOVE" 61 #define UEVENT_ARR_SIZE 10 62 #define UEVENT_POLL_WAIT_TIME 100 63 #define WAIT_THREAD_END_TIME_MS 1 64 65 #define DP_PORT_COUNT 5 66 #define DP_PATH "/sys/class/switch/hdmi_audio" 67 #define DEVICE_PORT "device_port=" 68 69 #include <string> 70 71 namespace OHOS { 72 namespace AudioStandard { 73 using namespace std; 74 75 struct AudioPnpUevent { 76 const char *action; 77 const char *name; 78 const char *state; 79 const char *devType; 80 const char *subSystem; 81 const char *switchName; 82 const char *switchState; 83 const char *hidName; 84 const char *devName; 85 const char *anahsName; 86 }; 87 88 struct AudioEvent { 89 uint32_t eventType; 90 uint32_t deviceType; 91 std::string name; 92 std::string address; 93 std::string anahsName; 94 }; 95 } // namespace AudioStandard 96 } // namespace OHOS 97 #endif // AUDIO_PNP_PARAM