# Reporting Modem Events - [When to Use](#section337mcpsimp) - [Available APIs](#section340mcpsimp) - [How to Develop](#section183291958165215) - [\(Optional\) Commissioning and Verification](#section405mcpsimp) ## When to Use In a modem node thread, the messages reported by the modem are read cyclically, parsed into specific events, and then reported to RIL Adapter. ## Available APIs The following table describes the API for reporting modem events. **Table 1** API for reporting modem events

API

Description

static void OnNotificationResponse(const char *s, const char *sms_pdu)

Reports modem events.

## How to Develop In the **s\_tid\_read** thread of the modem node, call **OnNotificationResponse\(\)** to parse the data read into a specific event and call **OnRadioEventNotify\(\)** to report the generated event to RIL Adapter. ``` bool IsCallStatusUpdated(const char *s) { return (StrBeginWith(s, "+CRING:") || StrBeginWith(s, "RING") || StrBeginWith(s, "NO CARRIER") || StrBeginWith(s, "+CCWA")); } bool IsSetRadioPower(const char *s) { return StrBeginWith(s, "+CFUN: 0"); } static void OnNotificationResponse(const char *s, const char *sms_pdu) { if (IsCallStatusUpdated(s)) { OnRadioEventNotify(HNOTI_CALL_STATUS, NULL, 0); } else if (IsSetRadioPower(s)) { SetRadioState(RADIO_OFF); } ... } ``` ## \(Optional\) Commissioning and Verification 1. Use the **HDC** tool to connect to a commissioning device, and run the **hdc file send** command to send the generated **libvendor.z.so** library file to the **/system/lib/** directory. 2. Run the **hdc shell sync** and **hdc shell reboot** commands to restart the device. 3. Run the **hdc shell hilog** command to check whether **OnNotificationResponse\(\)** is successfully executed based on the log information.