@@ -460,6 +460,35 @@ struct bt_hfp_ag_cb {
460460 */
461461 void (* hf_indicator_value )(struct bt_hfp_ag * ag , enum hfp_ag_hf_indicators indicator ,
462462 uint32_t value );
463+
464+ /** Vendor specific / custom AT command callback
465+ *
466+ * If this callback is provided it will be called whenever an AT command
467+ * is received from the HF that is not recognized and handled by the
468+ * HFP AG stack.
469+ *
470+ * The @p cmd string contains the full AT command line as received on
471+ * the RFCOMM link, without the terminating carriage return character.
472+ * Example: "AT+XMI=1,2".
473+ *
474+ * The return value controls how the HFP AG core replies:
475+ * - ret < 0 : The command is rejected and the core will send the
476+ * standard "ERROR" or "+CME ERROR:<code>" depending on
477+ * the CMEE setting.
478+ * - ret == 0: The command was handled successfully and the core will
479+ * send the standard "OK" final result code.
480+ * - ret > 0 : The application is responsible for sending all responses,
481+ * including the final "OK" / "ERROR" / "+CME ERROR:<code>",
482+ * by calling @ref bt_hfp_ag_send_vendor from an appropriate
483+ * context. The HFP AG core will NOT send any automatic
484+ * final result code in this case.
485+ *
486+ * @param ag HFP AG object.
487+ * @param cmd Zero-terminated AT command line without trailing <CR>.
488+ *
489+ * @return Application-defined result as described above.
490+ */
491+ int (* vendor_at_cmd )(struct bt_hfp_ag * ag , const char * cmd );
463492};
464493
465494/** @brief Register HFP AG profile
@@ -819,6 +848,26 @@ int Z_API(bt_hfp_ag_battery_level)(struct bt_hfp_ag *ag, uint8_t level);
819848 */
820849int Z_API (bt_hfp_ag_service_availability )(struct bt_hfp_ag * ag , bool available );
821850
851+ /** @brief Send vendor specific / custom AT response from the AG
852+ *
853+ * Send a vendor specific or otherwise custom AT result or unsolicited
854+ * response line from the AG to the HF.
855+ * The given string is sent as-is and will be wrapped with the standard
856+ * "\r\n" prefix and suffix on the wire.
857+ *
858+ * Examples (rsp non-NULL):
859+ * - rsp == NULL -> sends a standard final result "OK"
860+ * (i.e. "\r\nOK\r\n").
861+ * - rsp = "+CUSTOM:0" -> sends "\r\n+CUSTOM:0\r\n"
862+ * - rsp = "+VENDOR:1" -> sends "\r\n+VENDOR:1\r\n"
863+ *
864+ * @param ag HFP AG object.
865+ * @param rsp AT response string without CR/LF terminators, or NULL to send "OK".
866+ *
867+ * @return 0 in case of success or negative value in case of error.
868+ */
869+ int Z_API (bt_hfp_ag_send_vendor )(struct bt_hfp_ag * ag , const char * rsp );
870+
822871/** @brief Activate/deactivate HF indicator
823872 *
824873 * It allows HF to issue the +BIND unsolicited result code to
0 commit comments