Skip to content

Commit 6f7f5ae

Browse files
author
Amanda Butler
authored
Copy edit GattClient.h
Make copy edits to file.
1 parent 3a80f8b commit 6f7f5ae

File tree

1 file changed

+70
-71
lines changed

1 file changed

+70
-71
lines changed

features/FEATURE_BLE/ble/GattClient.h

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -36,49 +36,49 @@
3636
*/
3737

3838
/**
39-
* Define procedures required for interracting with a distant GATT server.
39+
* Define procedures required for interacting with a distant GATT server.
4040
*
4141
* @par Discovery procedures
4242
*
43-
* A GATT server host a fixed set of services. These services are a logical
44-
* composition of Characteristic which may be discovered, read, written or also
43+
* A GATT server hosts a fixed set of services. These services are a logical
44+
* composition of characteristics that may be discovered, read, written or also
4545
* broadcast their state to a connected client. These characteristics may also
46-
* contain meta information named characteristic descriptors. A characteristic
46+
* contain metainformation named characteristic descriptors. A characteristic
4747
* descriptor may be used to indicate the unit used for a characteristic value,
4848
* describe in a textual form the characterisic purpose or allow a client to
4949
* register for notification of updates of the characteristic value.
5050
*
51-
* Prior to any interaction with server characteristic, a GATT client should
52-
* discover the layout of the services and characteristics present on the
51+
* Prior to any interaction with server characteristic, a GATT client
52+
* discovers the layout of the services and characteristics present on the
5353
* server.
5454
*
5555
* The layout of the descriptors of a characteristic may also be issued to
5656
* as an extra discovery step.
5757
*
5858
* @par Attribute manipulation
5959
*
60-
* As a result of the discovery process the client can start interracting with
60+
* As a result of the discovery process, the client can start interacting with
6161
* the characteristic discovered. Depending on the characteristic properties
62-
* (acquired during discovery) a client can read or write the value of a given
62+
* (acquired during discovery), a client can read or write the value of a given
6363
* characteristic.
6464
*
65-
* mbed BLE abstract most read and write operation to offer a single API which
65+
* Mbed BLE abstracts most read and write operations to offer a single API that
6666
* can be used to read or write characteristics values. Application code does not
6767
* have to handle the fragmentation/reassembly process necessary if the attribute
6868
* value to transported cannot fit in a single data packet.
6969
*
7070
* @par Server Initiated events
7171
*
72-
* If a characteristic has the notify or indicate property set then a client may
73-
* register to notification or indication from the characteristic. When the
74-
* characteristic value is updated by the server, the server can forward the
72+
* If a characteristic has to notify or indicate a property set; then, a client may
73+
* register to a notification or indication from the characteristic. When the
74+
* server updates the characteristic value, the server can forward the
7575
* new value to the registered clients. The notification/indication mechanism
7676
* prevents polling from the client and therefore minimize the transactions
7777
* involved between a client and a server.
7878
*
7979
* Registration is made by writing the Client Characteristic Configuration
80-
* Descriptor which shall be present in the characteristic if the notify or
81-
* indicate properties are set. That descriptor shall be discovered by the client
80+
* Descriptor, which is present in the characteristic if the notify or
81+
* indicate properties are set. The client discovers that descriptor
8282
* if it intends to register to server initiated events.
8383
*/
8484
class GattClient {
@@ -169,7 +169,7 @@ class GattClient {
169169

170170
/*
171171
* The following functions are meant to be overridden in the platform
172-
* specific sub-class.
172+
* specific subclass.
173173
*/
174174
public:
175175

@@ -179,17 +179,17 @@ class GattClient {
179179
* Launch the service and characteristic discovery procedure of a GATT server
180180
* peer.
181181
*
182-
* The procedure will invoke application callbacks for matching services or
182+
* The procedure invokes application callbacks for matching services or
183183
* characteristics. The process ends after all the services and
184184
* characteristics present on the distant GATT server have been discovered.
185185
* Termination callbacks registered with onServiceDiscoveryTermination() are
186186
* invoked to notify the application of the termination of the procedure.
187187
*
188188
* Application code can track the status of the procedure by invoking the
189-
* function isServiceDiscoveryActive() which will return true if the
189+
* function isServiceDiscoveryActive(), which returns true if the
190190
* procedure is ongoing.
191191
*
192-
* At any point application code can terminate prematurely the discovery
192+
* At any point, application code can prematurely terminate the discovery
193193
* procedure by calling terminateServiceDiscovery().
194194
*
195195
* @param[in] connectionHandle Handle of the connection with the peer GATT
@@ -199,27 +199,27 @@ class GattClient {
199199
* @param[in] cc Characteristic discovered event handler invoked when a
200200
* matching characteristic has been found. This parameter may be NULL.
201201
* @param[in] matchingServiceUUID UUID of the service the caller is
202-
* interested in. If a service discovered matches this filter then @p sc is
203-
* invoked with it. The special value BLE_UUID_UNKNOWN act as a wildcard
202+
* interested in. If a service discovered matches this filter, then @p sc is
203+
* invoked with it. The special value BLE_UUID_UNKNOWN acts as a wildcard,
204204
* which can be used to discover all services present on the peer GATT
205205
* server.
206206
* @param[in] matchingCharacteristicUUIDIn UUID of the characteristic the
207207
* caller is interested in. If a characteristic discovered matches this
208-
* filter then @p cc is invoked with it. The special value BLE_UUID_UNKNOWN
209-
* act as a wildcard which can be used to discover all services present on
208+
* filter, then @p cc is invoked with it. The special value BLE_UUID_UNKNOWN
209+
* acts as a wildcard, which can be used to discover all services present on
210210
* the peer GATT server.
211211
*
212212
* @par Discovery procedure implementation detail
213213
*
214214
* It is recommended to implement several strategies based on the
215215
* combination of callbacks and filters passed in input to efficiently
216216
* realize the discovery procedure:
217-
* - If @p sc and @p cc are NULL then it is not necessay to initiate any
218-
* discovery and the termination handlers can be invoked immediately.
219-
* - If @p matchingServiceUUID is set then the GATT discover services by
220-
* service UUID procedure should be used otherwise the GATT discover primary
221-
* services procedure should be used..
222-
* - If @p cc is NULL then the discovery process should end after the discovery
217+
* - If @p sc and @p cc are NULL, then it is not necessay to initiate any
218+
* discovery, and the termination handlers can be invoked immediately.
219+
* - If @p matchingServiceUUID is set, then the GATT discover services by
220+
* service UUID procedure should be used; otherwise, the GATT discover primary
221+
* services procedure should be used.
222+
* - If @p cc is NULL, then the discovery process should end after the discovery
223223
* of the services.
224224
*
225225
* @return BLE_ERROR_NONE if the discovery procedure has been successfully
@@ -247,26 +247,26 @@ class GattClient {
247247
/**
248248
* Launch the service discovery procedure of a GATT server peer.
249249
*
250-
* The procedure will invoke the application callback for matching services.
250+
* The procedure invokes the application callback for matching services.
251251
* The process ends after all the services present on the distant GATT
252252
* server have been discovered.
253253
* Termination callbacks registered with onServiceDiscoveryTermination() are
254254
* invoked to notify the application of the termination of the procedure.
255255
*
256256
* Application code can track the status of the procedure by invoking the
257-
* function isServiceDiscoveryActive() which will return true if the
257+
* function isServiceDiscoveryActive(), which returns true if the
258258
* procedure is ongoing.
259259
*
260-
* At any point application code can terminate prematurely the discovery
260+
* At any point, application code can prematurely terminate the discovery
261261
* procedure by calling terminateServiceDiscovery().
262262
*
263263
* @param[in] connectionHandle Handle of the connection with the peer GATT
264264
* server.
265265
* @param[in] callback Service discovered event handler invoked when a
266266
* matching service has been discovered. This parameter may be NULL.
267267
* @param[in] matchingServiceUUID UUID of the service the caller is
268-
* interested in. If a service discovered match this filter then @p sc is
269-
* invoked with it. The special value BLE_UUID_UNKNOWN act is a wildcard
268+
* interested in. If a service discovered matches this filter, then @p sc is
269+
* invoked with it. The special value BLE_UUID_UNKNOWN act is a wildcard,
270270
* which can be used to discover all services present on the peer GATT
271271
* server.
272272
*
@@ -279,7 +279,7 @@ class GattClient {
279279
const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)
280280
) {
281281
/* We take advantage of the property
282-
* that providing NULL for the characteristic callback will result in
282+
* that providing NULL for the characteristic callback results in
283283
* characteristic discovery being skipped for each matching
284284
* service. This allows for an inexpensive method to discover only
285285
* services. Porters are free to override this. */
@@ -298,10 +298,10 @@ class GattClient {
298298
* invoked to notify the application of the termination of the procedure.
299299
*
300300
* Application code can track the status of the procedure by invoking the
301-
* function isServiceDiscoveryActive() which will return true if the
301+
* function isServiceDiscoveryActive(), which returns true if the
302302
* procedure is ongoing.
303303
*
304-
* At any point application code can terminate prematurely the discovery
304+
* At any point, application code can prematurely terminate the discovery
305305
* procedure by calling terminateServiceDiscovery().
306306
*
307307
* @param[in] connectionHandle Handle of the connection with the peer GATT
@@ -358,7 +358,7 @@ class GattClient {
358358
/**
359359
* Initiate the read procedure of an attribute handle.
360360
*
361-
* Once the attribute value has been read in its entirety the process issues
361+
* Once the attribute value has been read in its entirety, the process issues
362362
* an attribute read event and passes it to all events handlers registered
363363
* by onDataRead.
364364
*
@@ -368,23 +368,23 @@ class GattClient {
368368
* @param[in] offset The offset from the start of the attribute value to be
369369
* read.
370370
*
371-
* @return BLE_ERROR_NONE if read procedure was successfully started.
371+
* @return BLE_ERROR_NONE if read procedure successfully started.
372372
*
373373
* @par Implementation notes:
374374
*
375375
* Reading the attribute value in its entirety may involve sending several
376376
* GATT requests to the peer. The following algorithm may be used to
377377
* implement the process:
378378
*
379-
* If the offset is equal to 0 then send a read request otherwise send a
379+
* If the offset is equal to 0, then send a read request; otherwise, send a
380380
* read blob request at the specified offset.
381381
*
382382
* While the attribute data in the response are MTU - 1 long:
383383
* - Concat the response to the value containing the previous responses.
384384
* - Increment the value of the offset by MTU - 1.
385385
* - Send a read blob request with the updated offset.
386386
*
387-
* Finally concat the last response with the value containing all the
387+
* Finally, concat the last response with the value containing all the
388388
* previous responses and forward that value to the event handlers.
389389
*/
390390
virtual ble_error_t read(
@@ -405,39 +405,39 @@ class GattClient {
405405
/**
406406
* Initiate a write procedure on an attribute value.
407407
*
408-
* If @p cmd is equal to GATT_OP_WRITE_REQ then the status of the operation
409-
* is reported to the event handlers registered via onDataWritten().
408+
* If @p cmd is equal to GATT_OP_WRITE_REQ, then the status of the operation
409+
* is reported to the event handlers registered through onDataWritten().
410410
*
411411
* @param[in] cmd Type of the write procedure used. If GATT_OP_WRITE_CMD
412-
* is set then value length shall not be greater than the size of the mtu
412+
* is set, then value length is not greater than the size of the mtu
413413
* of connHandle minus three.
414414
* @param[in] connHandle Handle of the connection used to send the write
415415
* request or command.
416416
* @param[in] attributeHandle Handle of the attribute value to write.
417417
* @param[in] length Number of bytes present in @p value.
418418
* @param[in] value Data buffer to write to attributeHandle.
419419
*
420-
* @return BLE_ERROR_NONE if the write procedure was successfully started.
420+
* @return BLE_ERROR_NONE if the write procedure successfully started.
421421
*
422422
* @par Implementation notes:
423423
*
424-
* If the operation is a write command then an implementation shall use the
425-
* GATT write without response procedure and an error shall be returned if
424+
* If the operation is a write command, then an implementation uses the
425+
* GATT write without response procedure and an error is returned if
426426
* the data buffer to write is larger than the size of the MTU - 3.
427427
*
428428
* If the operation is a write command and the size of the data buffer to
429-
* write is less than than the size of the MTU - 3 then the ATT write request
430-
* procedure shall be used and the response shall be reported to the handlers
429+
* write is less than than the size of the MTU - 3, then the ATT write request
430+
* procedure is used, and the response is reported to the handlers
431431
* listening for write response.
432432
*
433-
* Otherwise the data buffer to write shall be divided in chunks with a
434-
* maximum size of MTU - 5. Those chunks shall be sent sequentially to the
433+
* Otherwise, the data buffer to write is divided in chunks with a
434+
* maximum size of MTU - 5. Those chunks are sent sequentially to the
435435
* peer in ATT prepare write requests. If an error response is received
436-
* during the process, the procedure shall end immediately, the prepared
437-
* write discarded and an error shall be reported to the application handlers.
438-
* Once all the chunks have been sent, the transaction shall be completed
439-
* by sending an execute write request to the peer. The peer response shall
440-
* be forwarded to the application handlers.
436+
* during the process, the procedure ends immediately, the prepared
437+
* write is discarded and an error is reported to the application handlers.
438+
* Once all the chunks have been sent, the transaction is completed
439+
* by sending an execute write request to the peer. The peer response is
440+
* forwarded to the application handlers.
441441
*/
442442
virtual ble_error_t write(
443443
GattClient::WriteOp_t cmd,
@@ -612,8 +612,8 @@ class GattClient {
612612
/**
613613
* @brief Terminate an ongoing characteristic descriptor discovery procedure.
614614
*
615-
* If the procedure is active then it shall end and the termination handler
616-
* associated with the procedure shall be called.
615+
* If the procedure is active, then it ends, and the termination handler
616+
* associated with the procedure is called.
617617
*
618618
* @param[in] characteristic The characteristic containing the descriptors
619619
* being discovered.
@@ -642,8 +642,8 @@ class GattClient {
642642
/**
643643
* Register a shutdown event handler.
644644
*
645-
* The registered handler will be invoked when the GattClient instance is
646-
* about to be shutdown.
645+
* The registered handler is invoked when the GattClient instance is
646+
* about to be shut down.
647647
*
648648
* @param[in] callback Event handler to invoke when a shutdown event is
649649
* available.
@@ -661,10 +661,10 @@ class GattClient {
661661
/**
662662
* Register a shutdown event handler.
663663
*
664-
* The registered handler will be invoked when the GattClient instance is
665-
* about to be shutdown.
664+
* The registered handler is invoked when the GattClient instance is
665+
* about to be shut down.
666666
*
667-
* @param[in] objPtr Instance which will be used to invoke @p memberPtr.
667+
* @param[in] objPtr Instance that will be used to invoke @p memberPtr.
668668
* @param[in] memberPtr Event handler to invoke when a shutdown event is
669669
* available.
670670
*/
@@ -705,24 +705,23 @@ class GattClient {
705705
/**
706706
* Reset the state of the GattClient instance.
707707
*
708-
* Prior to any state modification shutdown event handlers shall be notified
709-
* that the GattClient instance is about to be shutdown. Then running
710-
* procedures shall be ended. Finally the state of the instance shall be
711-
* reset.
708+
* Prior to any state modification, shutdown event handlers are notified
709+
* that the GattClient instance is about to be shut down. Then, running
710+
* procedures end. Finally, the state of the instance is reset.
712711
*
713712
* @par implementation note
714713
*
715714
* This function is meant to be overridden in the platform-specific
716-
* sub-class. Nevertheless, the sub-class is only expected to reset its
717-
* state and not the data held in GattClient members. This shall be achieved
718-
* by a call to GattClient::reset() from the sub-class' reset()
715+
* subclass. Nevertheless, the subclass only resets its
716+
* state and not the data held in GattClient members. This is achieved
717+
* by a call to GattClient::reset() from the subclass' reset()
719718
* implementation.
720719
*
721720
* @return BLE_ERROR_NONE on success.
722721
*/
723722
virtual ble_error_t reset(void)
724723
{
725-
/* Notify that the instance is about to shutdown */
724+
/* Notify that the instance is about to shut down. */
726725
shutdownCallChain.call(this);
727726
shutdownCallChain.clear();
728727

@@ -769,7 +768,7 @@ class GattClient {
769768
}
770769

771770
/**
772-
* Forward an Handle Value Notification or Indication event to all registered
771+
* Forward a handle value notification or indication event to all registered
773772
* handlers.
774773
*
775774
* @important This function is meant to be called from the vendor

0 commit comments

Comments
 (0)