@@ -386,7 +386,7 @@ void pbdrv_bluetooth_peripheral_release(pbdrv_bluetooth_peripheral_t *peripheral
386386 *
387387 * @return The name of the connected peripheral. May not be set.
388388 */
389- const char * pbdrv_bluetooth_peripheral_get_name (void );
389+ const char * pbdrv_bluetooth_peripheral_get_name (pbdrv_bluetooth_peripheral_t * peripheral );
390390
391391/**
392392 * Starts scanning for a BLE device and connects to it.
@@ -395,7 +395,7 @@ const char *pbdrv_bluetooth_peripheral_get_name(void);
395395 * @return ::PBIO_SUCCESS if the operation was scheduled.
396396 * ::PBIO_ERROR_BUSY if already connected or another peripheral operation is ongoing.
397397 */
398- pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect (pbdrv_bluetooth_peripheral_connect_config_t * config );
398+ pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_connect_config_t * config );
399399
400400/**
401401 * Disconnect from the peripheral.
@@ -404,7 +404,7 @@ pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect(pbdrv_bluetooth_periphe
404404 * @return ::PBIO_SUCCESS if disconnection schefuled or when already disconnected.
405405 * ::PBIO_ERROR_BUSY if another peripheral operation is ongoing.
406406 */
407- pbio_error_t pbdrv_bluetooth_peripheral_disconnect (void );
407+ pbio_error_t pbdrv_bluetooth_peripheral_disconnect (pbdrv_bluetooth_peripheral_t * peripheral );
408408
409409/**
410410 * Find a characteristic by UUID and properties.
@@ -417,7 +417,7 @@ pbio_error_t pbdrv_bluetooth_peripheral_disconnect(void);
417417 * ::PBIO_ERROR_BUSY if another peripheral operation is ongoing.
418418 * ::PBIO_ERROR_NO_DEV if no peripheral is connected.
419419 */
420- pbio_error_t pbdrv_bluetooth_peripheral_discover_characteristic (pbdrv_bluetooth_peripheral_char_t * characteristic );
420+ pbio_error_t pbdrv_bluetooth_peripheral_discover_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_char_t * characteristic );
421421
422422/**
423423 * Read a characteristic.
@@ -427,13 +427,14 @@ pbio_error_t pbdrv_bluetooth_peripheral_discover_characteristic(pbdrv_bluetooth_
427427 * ::PBIO_ERROR_NO_DEV if not connected to a peripheral.
428428 * ::PBIO_ERROR_BUSY if another operation is ongoing.
429429 */
430- pbio_error_t pbdrv_bluetooth_peripheral_read_characteristic (pbdrv_bluetooth_peripheral_char_t * characteristic );
430+ pbio_error_t pbdrv_bluetooth_peripheral_read_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_char_t * characteristic );
431431
432432/**
433433 * Write a value to a peripheral characteristic without response.
434434 *
435435 * The write is queued for transmission and does not await completion.
436436 *
437+ * @param [in] peri The peripheral to write to.
437438 * @param [in] handle The handle of the characteristic value to write.
438439 * @param [in] data The data to write.
439440 * @param [in] size The size of @p data in bytes.
@@ -442,14 +443,14 @@ pbio_error_t pbdrv_bluetooth_peripheral_read_characteristic(pbdrv_bluetooth_peri
442443 * ::PBIO_ERROR_BUSY if another peripheral operation is ongoing.
443444 * ::PBIO_ERROR_INVALID_ARG if @p size is too big.
444445 */
445- pbio_error_t pbdrv_bluetooth_peripheral_write_characteristic (uint16_t handle , const uint8_t * data , size_t size );
446+ pbio_error_t pbdrv_bluetooth_peripheral_write_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , uint16_t handle , const uint8_t * data , size_t size );
446447
447448/**
448449 * Awaits for a task associated with a peripheral to complete. Used to await
449450 * characteristic discover/read/write, scan-and-connect, or disconnect.
450451 *
451452 * @param [in] state Protothread state. Not used in all implementations.
452- * @param [in] context Not used .
453+ * @param [in] context The peripheral .
453454 * @return ::PBIO_SUCCESS on completion.
454455 * ::PBIO_ERROR_AGAIN while awaiting.
455456 * or a thread specific error code if the operation failed.
@@ -599,28 +600,27 @@ static inline pbio_error_t pbdrv_bluetooth_peripheral_get_available(pbdrv_blueto
599600static inline void pbdrv_bluetooth_peripheral_release (pbdrv_bluetooth_peripheral_t * peripheral , void * user ) {
600601}
601602
602- static inline const char * pbdrv_bluetooth_peripheral_get_name (void ) {
603+ static inline const char * pbdrv_bluetooth_peripheral_get_name (pbdrv_bluetooth_peripheral_t * peripheral ) {
603604 return NULL ;
604605}
605606
606- static inline pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect (pbdrv_bluetooth_peripheral_connect_config_t * config ) {
607+ static inline pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_connect_config_t * config ) {
607608 return PBIO_ERROR_NOT_SUPPORTED ;
608609}
609610
610- static inline pbio_error_t pbdrv_bluetooth_peripheral_disconnect (void ) {
611+ static inline pbio_error_t pbdrv_bluetooth_peripheral_disconnect (pbdrv_bluetooth_peripheral_t * peripheral ) {
611612 return PBIO_ERROR_NOT_SUPPORTED ;
612613}
613614
614- static inline pbio_error_t pbdrv_bluetooth_peripheral_discover_characteristic (pbdrv_bluetooth_peripheral_char_t * characteristic ) {
615+ static inline pbio_error_t pbdrv_bluetooth_peripheral_discover_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_char_t * characteristic ) {
615616 return PBIO_ERROR_NOT_SUPPORTED ;
616617}
617618
618- static inline pbio_error_t pbdrv_bluetooth_peripheral_read_characteristic (
619- pbdrv_bluetooth_peripheral_char_t * characteristic ) {
619+ static inline pbio_error_t pbdrv_bluetooth_peripheral_read_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , pbdrv_bluetooth_peripheral_char_t * characteristic ) {
620620 return PBIO_ERROR_NOT_SUPPORTED ;
621621}
622622
623- static inline pbio_error_t pbdrv_bluetooth_peripheral_write_characteristic (uint16_t handle , const uint8_t * data , size_t size ) {
623+ static inline pbio_error_t pbdrv_bluetooth_peripheral_write_characteristic (pbdrv_bluetooth_peripheral_t * peripheral , uint16_t handle , const uint8_t * data , size_t size ) {
624624 return PBIO_ERROR_NOT_SUPPORTED ;
625625}
626626
0 commit comments