Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mpx_api.h Source File

mpx_api.h

00001 /*
00002  * Copyright (c) 2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may 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,
00013  * WITHOUT 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 #ifndef MPX_API_H_
00019 #define MPX_API_H_
00020 
00021 struct mcps_data_req_s;
00022 struct mcps_data_conf_s;
00023 struct mcps_data_ind_s;
00024 struct mcps_purge_s;
00025 
00026 typedef struct mpx_api_s mpx_api_t;
00027 
00028 /**
00029  * @brief mpx_data_request MPX_DATA request with user ID
00030  * @param api API to handle the request
00031  * @param data MCPS-DATA.request specific values
00032  * @param user_id MPX user ID
00033  *
00034  */
00035 typedef void mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s *data, uint16_t user_id);
00036 
00037 /**
00038  * @brief mpx_data_queue_clean clean MPX user data
00039  * @param api API to handle the request
00040  * @param purge MCPS-purge request
00041  * @param user_id MPX user ID
00042  * @return 0 if purge requst was OK, non-zero otherwise
00043  *
00044  */
00045 typedef uint8_t mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
00046 
00047 /**
00048  * @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request
00049  * @param api The API which handled the response
00050  * @param data MCPS-DATA.confirm specific values
00051  * @param user_id MPX user ID
00052  */
00053 typedef void mpx_data_confirm(const mpx_api_t *api, const struct mcps_data_conf_s *data);
00054 
00055 /**
00056  * @brief mpx_data_indication MPX-DATA confirm is called as a response to MPX-DATA request
00057  * @param api The API which handled the response
00058  * @param data MCPS-DATA.indication specific values
00059  * @param user_id MPX user ID
00060  */
00061 typedef void mpx_data_indication(const mpx_api_t *api, const struct mcps_data_ind_s *data);
00062 
00063 /**
00064  * @brief mpx_header_size_get Function for request MPX user head room size
00065  * @param api The API which handled the response
00066  * @param user_id MPX user ID
00067  *
00068  * @return >0 Head room size in bytes
00069  * @return 0 When Unknown User Id
00070  */
00071 typedef uint16_t mpx_header_size_get(const mpx_api_t *api, uint16_t user_id);
00072 
00073 /**
00074  * @brief mpx_data_cb_register MPX-DATA confirm cb register by user
00075  * @param api The API which handled the response
00076  * @param confirm_cb MPX Data Confirm call back
00077  * @param indication_cb MPX Data indication
00078  * @param user_id MPX user ID
00079  *
00080  * @return 0 register OK
00081  * @return -1 Unknown User ID
00082  */
00083 typedef int8_t mpx_data_cb_register(const mpx_api_t *api, mpx_data_confirm *confirm_cb, mpx_data_indication *indication_cb, uint16_t user_id);
00084 
00085 /**
00086  * \brief Struct mpx_api_s defines functions for MPX user for register call backs and send data.
00087  */
00088 struct mpx_api_s {
00089     mpx_data_request *mpx_data_request;             /**< MPX data request. */
00090     mpx_data_purge_request *mpx_data_purge;            /**< MPX data Purge. */
00091     mpx_header_size_get *mpx_headroom_size_get;     /**< MPX headroom size get in bytes. */
00092     mpx_data_cb_register *mpx_user_registration;    /**< MPX User cb registration must be call before enable to send or RX data*/
00093 };
00094 
00095 
00096 #endif /* MPX_API_H_ */