1#!/usr/bin/env python3 2# 3# Copyright 2018 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17"""Apollo's event logs regexp for each button action.""" 18 19EVENT_REGEX = ( 20 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)\r\n') 21VOL_CHANGE_REGEX = ( 22 r'(?P<time_stamp>\d+)\sVolume = (?P<vol_level>\d+)(.*)\r\n') 23VOLUP_REGEX = ( 24 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)3202(.*)\r\n') 25VOLDOWN_REGEX = ( 26 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)320a(.*)\r\n') 27AVRCP_PLAY_REGEX = (r'(?P<time_stamp>\d+)\sAVRCP ' 28 r'play\r\n') 29AVRCP_PAUSE_REGEX = (r'(?P<time_stamp>\d+)\sAVRCP ' 30 r'paused\r\n') 31MIC_OPEN_EVENT_REGEX = ( 32 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 33 r'\[3206\](.*)\r\n') 34MIC_CLOSE_EVENT_REGEX = ( 35 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 36 r'\[3207\](.*)\r\n') 37PREV_TRACK_EVENT_REGEX = ( 38 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 39 r'\[3208\](.*)\r\n') 40PREV_CHANNEL_EVENT_REGEX = ( 41 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 42 r'\[3209\](.*)\r\n') 43NEXT_TRACK_EVENT_REGEX = ( 44 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 45 r'\[3200\](.*)\r\n') 46NEXT_CHANNEL_EVENT_REGEX = ( 47 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 48 r'\[3201\](.*)\r\n') 49FETCH_NOTIFICATION_EVENT_REGEX = ( 50 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)State Match(.*)' 51 r'\[3205\](.*)\r\n') 52VOICE_CMD_COMPLETE_REGEX = ( 53 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])\sDspOnVoiceCommandComplete\r\n') 54VOICE_CMD_START_REGEX = ( 55 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])\sDspStartVoiceCommand(.*)\r\n') 56MIC_OPEN_PROMT_REGEX = ( 57 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)AudioPromptPlay 33(.*)\r\n') 58MIC_CLOSE_PROMT_REGEX = ( 59 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z])(.*)AudioPromptPlay 34(.*)\r\n') 60POWER_ON_EVENT_REGEX = ( 61 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z]) --hello--(.*)PowerOn(.*)\r\n') 62POWER_OFF_EVENT_REGEX = ( 63 r'(?P<time_stamp>\d+)\s(?P<log_level>[A-Z]) EvtAW:320d(.*)\r\n') 64