takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

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  *
00043  */
00044 typedef void mpx_data_purge_request(const mpx_api_t *api, struct mcps_purge_s *purge, uint16_t user_id);
00045 
00046 /**
00047  * @brief mpx_data_confirm MPX-DATA confirm is called as a response to MPX-DATA request
00048  * @param api The API which handled the response
00049  * @param data MCPS-DATA.confirm specific values
00050  * @param user_id MPX user ID
00051  */
00052 typedef void mpx_data_confirm(const mpx_api_t* api, const struct mcps_data_conf_s *data);
00053 
00054 /**
00055  * @brief mpx_data_indication MPX-DATA confirm is called as a response to MPX-DATA request
00056  * @param api The API which handled the response
00057  * @param data MCPS-DATA.indication specific values
00058  * @param user_id MPX user ID
00059  */
00060 typedef void mpx_data_indication(const mpx_api_t* api, const struct mcps_data_ind_s *data);
00061 
00062 /**
00063  * @brief mpx_header_size_get Function for request MPX user head room size
00064  * @param api The API which handled the response
00065  * @param user_id MPX user ID
00066  *
00067  * @return >0 Head room size in bytes
00068  * @return 0 When Unknown User Id
00069  */
00070 typedef uint16_t mpx_header_size_get(const mpx_api_t * api, uint16_t user_id);
00071 
00072 /**
00073  * @brief mpx_data_cb_register MPX-DATA confirm cb register by user
00074  * @param api The API which handled the response
00075  * @param confirm_cb MPX Data Confirm call back
00076  * @param indication_cb MPX Data indication
00077  * @param user_id MPX user ID
00078  *
00079  * @return 0 register OK
00080  * @return -1 Unknown User ID
00081  */
00082 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);
00083 
00084 /**
00085  * \brief Struct mpx_api_s defines functions for MPX user for register call backs and send data.
00086  */
00087 struct mpx_api_s {
00088     mpx_data_request * mpx_data_request;            /**< MPX data request. */
00089     mpx_data_purge_request *mpx_data_purge;            /**< MPX data Purge. */
00090     mpx_header_size_get * mpx_headroom_size_get;    /**< MPX headroom size get in bytes. */
00091     mpx_data_cb_register * mpx_user_registration;   /**< MPX User cb registration must be call before enable to send or RX data*/
00092 };
00093 
00094 
00095 #endif /* MPX_API_H_ */