1 /******************************************************************
3 * Copyright 2015 Intel Corporation All Rights Reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************/
19 #ifndef CA_BLE_LINUX_RECV_H
20 #define CA_BLE_LINUX_RECV_H
24 #include "caleinterface.h"
31 * Information used to keep track of received data fragments.
33 typedef struct _CAGattRecvInfo
37 * @name Peer Connection-specific Fields
39 * These fields are valid only as long as the peer is connected.
45 /// Callback invoked upon receiving all data from GATT peer.
46 CABLEDataReceivedCallback on_packet_received;
49 * Context object containing lock used for synchronized access to
50 * the @c on_packet_received callback since that callback is actually
53 CALEContext * context;
59 * Initialize a @c CAGattRecvInfo object.
61 * @param[in] info Pointer to @c CAGattRecvInfo object being
62 * initialized. No memory is allocated by this
63 * function. The caller is responsible for
64 * instantiating the object prior to calling this
67 void CAGattRecvInfoInitialize(CAGattRecvInfo * info);
70 * Destroy a @c CAGattRecvInfo object.
72 * Destruction of @a info involves deallocating and clearing out all
73 * fields, as necessary.
75 * @param[in] info Pointer to @c CAGattRecvInfo object being
76 * destroyed. Only the @a info fields are finalized.
77 * Memory of @a info itself is retained by the
80 void CAGattRecvInfoDestroy(CAGattRecvInfo * info);
83 * Handle data received from GATT a peer.
85 * @param[in] info Information required to complete the receive
87 * @param[in] data Octet array containing received data
89 * @param[in] length Length of the @a data array.
91 * @return @c true on success, @c false otherwise.
93 bool CAGattRecv(CAGattRecvInfo * info,
98 #endif /* CA_BLE_LINUX_RECV_H */