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.c Source File

ac_stream.c

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 stream.c
00019  * \copyright Copyright (c) ARM Ltd 2015
00020  * \author Donatien Garnier
00021  */
00022 
00023 #include "acore/ac_stream.h"
00024 #include "acore/ac_macros.h"
00025 
00026 //Called by supplier
00027 void ac_istream_init(ac_istream_t *pac_istream, ac_istream_fn fn, void *pUserParam)
00028 {
00029     pac_istream->fn = fn;
00030     pac_istream->pUserParam = pUserParam;
00031 }
00032 
00033 //Called by consumer
00034 void ac_istream_pull(ac_istream_t *pac_istream, ac_buffer_t *pDataIn, bool *pClose, size_t maxLength)
00035 {
00036     pac_istream->fn(pDataIn, pClose, maxLength, pac_istream->pUserParam);
00037 }
00038 
00039 //Called by consumer
00040 void ac_ostream_init(ac_ostream_t *pac_ostream, ac_ostream_fn fn, void *pUserParam)
00041 {
00042     pac_ostream->fn = fn;
00043     pac_ostream->pUserParam = pUserParam;
00044 }
00045 
00046 //Called by supplier
00047 void ac_ostream_push(ac_ostream_t *pac_ostream, ac_buffer_t *pDataOut, bool closed)
00048 {
00049     pac_ostream->fn(pDataOut, closed, pac_ostream->pUserParam);
00050 }