blob: f98acbf15a9384111637ec45d17912817b0d282b [file] [log] [blame]
Phil Burk5ed503c2017-02-01 09:38:15 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
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
Phil Burk3316d5e2017-02-15 11:23:01 -080017#ifndef AAUDIO_AAUDIO_SERVICE_DEFINITIONS_H
18#define AAUDIO_AAUDIO_SERVICE_DEFINITIONS_H
Phil Burk5ed503c2017-02-01 09:38:15 -080019
20#include <stdint.h>
21
22#include <aaudio/AAudio.h>
23
24#include "binding/RingBufferParcelable.h"
25
26namespace aaudio {
27
28// TODO move this an "include" folder for the service.
29
30struct AAudioMessageTimestamp {
Phil Burk3316d5e2017-02-15 11:23:01 -080031 int64_t position;
Phil Burk5ed503c2017-02-01 09:38:15 -080032 int64_t deviceOffset; // add to client position to get device position
Phil Burk3316d5e2017-02-15 11:23:01 -080033 int64_t timestamp;
Phil Burk5ed503c2017-02-01 09:38:15 -080034};
35
36typedef enum aaudio_service_event_e : uint32_t {
37 AAUDIO_SERVICE_EVENT_STARTED,
38 AAUDIO_SERVICE_EVENT_PAUSED,
39 AAUDIO_SERVICE_EVENT_FLUSHED,
40 AAUDIO_SERVICE_EVENT_CLOSED,
41 AAUDIO_SERVICE_EVENT_DISCONNECTED
42} aaudio_service_event_t;
43
44struct AAudioMessageEvent {
45 aaudio_service_event_t event;
46 int32_t data1;
47 int64_t data2;
48};
49
50typedef struct AAudioServiceMessage_s {
51 enum class code : uint32_t {
52 NOTHING,
53 TIMESTAMP,
54 EVENT,
55 };
56
57 code what;
58 union {
59 AAudioMessageTimestamp timestamp;
60 AAudioMessageEvent event;
61 };
62} AAudioServiceMessage;
63
Phil Burk5ed503c2017-02-01 09:38:15 -080064} /* namespace aaudio */
65
Phil Burk3316d5e2017-02-15 11:23:01 -080066#endif //AAUDIO_AAUDIO_SERVICE_DEFINITIONS_H