Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ac_stream.h Source File

ac_stream.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2017, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 /**
00018  * \file ac_stream.h
00019  * \copyright Copyright (c) ARM Ltd 2015
00020  * \author Donatien Garnier
00021  */
00022 
00023 #ifndef ACORE_STREAM_H_
00024 #define ACORE_STREAM_H_
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 struct __ac_istream;
00031 struct __ac_ostream;
00032 
00033 typedef struct __ac_istream ac_istream_t;
00034 typedef struct __ac_ostream ac_ostream_t;
00035 
00036 #include "stddef.h"
00037 #include "stdbool.h"
00038 #include "stdint.h"
00039 
00040 #include "acore/ac_buffer.h"
00041 
00042 typedef void (*ac_istream_fn)(ac_buffer_t *pDataIn, bool *pClose, size_t maxLength, void *pUserParam);
00043 typedef void (*ac_ostream_fn)(ac_buffer_t *pDataOut, bool closed, void *pUserParam);
00044 
00045 //Input stream -- pulled by consumer
00046 struct __ac_istream {
00047     ac_istream_fn fn;
00048     void *pUserParam;
00049 };
00050 
00051 //Output stream -- pushed by supplier
00052 struct __ac_ostream {
00053     ac_ostream_fn fn;
00054     void *pUserParam;
00055 };
00056 
00057 //Called by supplier
00058 void ac_istream_init(ac_istream_t *pac_istream, ac_istream_fn fn, void *pUserParam);
00059 //Called by consumer
00060 void ac_istream_pull(ac_istream_t *pac_istream, ac_buffer_t *pDataIn, bool *pClose, size_t maxLength);
00061 
00062 //Called by consumer
00063 void ac_ostream_init(ac_ostream_t *pac_ostream, ac_ostream_fn fn, void *pUserParam);
00064 //Called by supplier
00065 void ac_ostream_push(ac_ostream_t *pac_ostream, ac_buffer_t *pDataOut, bool closed);
00066 
00067 #ifdef __cplusplus
00068 }
00069 #endif
00070 
00071 #endif /* ACORE_STREAM_H_ */