1// Copyright 2016 The Android Open Source Project
2//
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// Handler for input events in /dev/input. AudioDaemonHandler is the base class
17// that other handlers inherit.
18
19#ifndef BRILLO_AUDIO_AUDIOSERVICE_AUDIO_DAEMON_HANDLER_H_
20#define BRILLO_AUDIO_AUDIOSERVICE_AUDIO_DAEMON_HANDLER_H_
21
22#include <linux/input.h>
23#include <media/IAudioPolicyService.h>
24
25namespace brillo {
26
27class AudioDaemonHandler {
28 public:
29  virtual ~AudioDaemonHandler(){};
30
31  // Initialize the handler.
32  //
33  // |aps| is a pointer to the binder object.
34  virtual void Init(android::sp<android::IAudioPolicyService> aps) = 0;
35
36  // Process input events from the kernel.
37  //
38  // |event| is a pointer to an input_event. This function should be able to
39  // gracefully handle input events that are not relevant to the functionality
40  // provided by this class.
41  virtual void ProcessEvent(const struct input_event& event) = 0;
42
43  // Inform the handler that the audio policy service has been disconnected.
44  virtual void APSDisconnect() = 0;
45
46  // Inform the handler that the audio policy service is reconnected.
47  //
48  // |aps| is a pointer to the binder object.
49  virtual void APSConnect(android::sp<android::IAudioPolicyService> aps) = 0;
50
51 protected:
52  // Pointer to the audio policy service.
53  android::sp<android::IAudioPolicyService> aps_;
54};
55
56}  // namespace brillo
57
58#endif  // BRILLO_AUDIO_AUDIOSERVICE_AUDIO_DAEMON_HANDLER_H_
59