Phil Burk | 2355edb | 2016-12-26 13:54:02 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | #ifndef OBOE_OBOE_SERVICE_H |
| 18 | #define OBOE_OBOE_SERVICE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | #include <oboe/OboeAudio.h> |
| 23 | |
| 24 | #include "binding/RingBufferParcelable.h" |
| 25 | |
| 26 | namespace oboe { |
| 27 | |
| 28 | // TODO move this an "include" folder for the service. |
| 29 | |
| 30 | struct OboeMessageTimestamp { |
| 31 | oboe_position_frames_t position; |
| 32 | int64_t deviceOffset; // add to client position to get device position |
| 33 | oboe_nanoseconds_t timestamp; |
| 34 | }; |
| 35 | |
| 36 | typedef enum oboe_service_event_e : uint32_t { |
| 37 | OBOE_SERVICE_EVENT_STARTED, |
| 38 | OBOE_SERVICE_EVENT_PAUSED, |
| 39 | OBOE_SERVICE_EVENT_FLUSHED, |
| 40 | OBOE_SERVICE_EVENT_CLOSED, |
| 41 | OBOE_SERVICE_EVENT_DISCONNECTED |
| 42 | } oboe_service_event_t; |
| 43 | |
| 44 | struct OboeMessageEvent { |
| 45 | oboe_service_event_t event; |
| 46 | int32_t data1; |
| 47 | int64_t data2; |
| 48 | }; |
| 49 | |
| 50 | typedef struct OboeServiceMessage_s { |
| 51 | enum class code : uint32_t { |
| 52 | NOTHING, |
| 53 | TIMESTAMP, |
| 54 | EVENT, |
| 55 | }; |
| 56 | |
| 57 | code what; |
| 58 | union { |
| 59 | OboeMessageTimestamp timestamp; |
| 60 | OboeMessageEvent event; |
| 61 | }; |
| 62 | } OboeServiceMessage; |
| 63 | |
| 64 | |
| 65 | } /* namespace oboe */ |
| 66 | |
| 67 | #endif //OBOE_OBOE_SERVICE_H |