xref: /btstack/src/ble/gatt-service/device_information_service_client.h (revision 1d3c1f7fa08e9939ba4288001f77d87257e587fd)
16bdecec7SMatthias Ringwald /*
26bdecec7SMatthias Ringwald  * Copyright (C) 2021 BlueKitchen GmbH
36bdecec7SMatthias Ringwald  *
46bdecec7SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
56bdecec7SMatthias Ringwald  * modification, are permitted provided that the following conditions
66bdecec7SMatthias Ringwald  * are met:
76bdecec7SMatthias Ringwald  *
86bdecec7SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
96bdecec7SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
106bdecec7SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
116bdecec7SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
126bdecec7SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
136bdecec7SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
146bdecec7SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
156bdecec7SMatthias Ringwald  *    from this software without specific prior written permission.
166bdecec7SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
176bdecec7SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
186bdecec7SMatthias Ringwald  *    monetary gain.
196bdecec7SMatthias Ringwald  *
206bdecec7SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
216bdecec7SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
226bdecec7SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
232fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
242fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
256bdecec7SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
266bdecec7SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
276bdecec7SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
286bdecec7SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
296bdecec7SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
306bdecec7SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
316bdecec7SMatthias Ringwald  * SUCH DAMAGE.
326bdecec7SMatthias Ringwald  *
336bdecec7SMatthias Ringwald  * Please inquire about commercial licensing options at
346bdecec7SMatthias Ringwald  * [email protected]
356bdecec7SMatthias Ringwald  *
366bdecec7SMatthias Ringwald  */
376bdecec7SMatthias Ringwald 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title Device Information Service Client
40fe5a6c4eSMilanka Ringwald  *
41fe5a6c4eSMilanka Ringwald  */
42fe5a6c4eSMilanka Ringwald 
436bdecec7SMatthias Ringwald #ifndef DEVICE_INFORMATION_SERVICE_CLIENT_H
446bdecec7SMatthias Ringwald #define DEVICE_INFORMATION_SERVICE_CLIENT_H
456bdecec7SMatthias Ringwald 
466bdecec7SMatthias Ringwald #include <stdint.h>
476bdecec7SMatthias Ringwald #include "btstack_defines.h"
486bdecec7SMatthias Ringwald #include "bluetooth.h"
496bdecec7SMatthias Ringwald #include "ble/gatt_client.h"
506bdecec7SMatthias Ringwald 
516bdecec7SMatthias Ringwald #if defined __cplusplus
526bdecec7SMatthias Ringwald extern "C" {
536bdecec7SMatthias Ringwald #endif
546bdecec7SMatthias Ringwald 
551ea30d1bSMilanka Ringwald /**
561ea30d1bSMilanka Ringwald  * @text The Device Information Service Client retrieves the following information from a remote device:
571ea30d1bSMilanka Ringwald  * - manufacturer name
581ea30d1bSMilanka Ringwald  * - model number
591ea30d1bSMilanka Ringwald  * - serial number
601ea30d1bSMilanka Ringwald  * - hardware revision
611ea30d1bSMilanka Ringwald  * - firmware revision
621ea30d1bSMilanka Ringwald  * - software revision
631ea30d1bSMilanka Ringwald  * - system ID
641ea30d1bSMilanka Ringwald  * - IEEE regulatory certification
651ea30d1bSMilanka Ringwald  * - PNP ID
66*1d3c1f7fSMatthias Ringwald  * - UDI for medical devices
671ea30d1bSMilanka Ringwald  */
681ea30d1bSMilanka Ringwald 
696bdecec7SMatthias Ringwald /* API_START */
706bdecec7SMatthias Ringwald 
716bdecec7SMatthias Ringwald /**
726bdecec7SMatthias Ringwald  * @brief Initialize Device Information Service.
736bdecec7SMatthias Ringwald  */
746bdecec7SMatthias Ringwald void device_information_service_client_init(void);
756bdecec7SMatthias Ringwald 
766bdecec7SMatthias Ringwald /**
776bdecec7SMatthias Ringwald  * @brief Query Device Information Service. The client will query the remote service and emit events:
786bdecec7SMatthias Ringwald  *
796bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_MANUFACTURER_NAME
806bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_MODEL_NUMBER
816bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_SERIAL_NUMBER
826bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_HARDWARE_REVISION
836bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_FIRMWARE_REVISION
846bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_SOFTWARE_REVISION
856bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_SYSTEM_ID
866bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_IEEE_REGULATORY_CERTIFICATION
876bdecec7SMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_PNP_ID
88*1d3c1f7fSMatthias Ringwald  * - GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_UDI_FOR_MEDICAL_DEVICES
896bdecec7SMatthias Ringwald  *
906bdecec7SMatthias Ringwald  * Event GATTSERVICE_SUBEVENT_DEVICE_INFORMATION_DONE is received when all queries are done, of if service was not found.
916bdecec7SMatthias Ringwald  * The status field of this event indicated ATT errors (see bluetooth.h).
926bdecec7SMatthias Ringwald  *
936bdecec7SMatthias Ringwald  * @param con_handle
946bdecec7SMatthias Ringwald  * @param packet_handler
956bdecec7SMatthias Ringwald  * @return status ERROR_CODE_SUCCESS on success, otherwise GATT_CLIENT_IN_WRONG_STATE if query is already in progress
966bdecec7SMatthias Ringwald  */
976bdecec7SMatthias Ringwald uint8_t device_information_service_client_query(hci_con_handle_t con_handle, btstack_packet_handler_t packet_handler);
986bdecec7SMatthias Ringwald 
996bdecec7SMatthias Ringwald 
1006bdecec7SMatthias Ringwald /**
1016bdecec7SMatthias Ringwald  * @brief De-initialize Device Information Service.
1026bdecec7SMatthias Ringwald  */
1036bdecec7SMatthias Ringwald void device_information_service_client_deinit(void);
1046bdecec7SMatthias Ringwald 
1056bdecec7SMatthias Ringwald /* API_END */
1066bdecec7SMatthias Ringwald 
1076bdecec7SMatthias Ringwald #if defined __cplusplus
1086bdecec7SMatthias Ringwald }
1096bdecec7SMatthias Ringwald #endif
1106bdecec7SMatthias Ringwald 
1116bdecec7SMatthias Ringwald #endif
112