@@ -61,6 +61,20 @@ enum loglevel_e {
61
61
#endif
62
62
#endif
63
63
64
+ /**
65
+ * @brief Reboot reasons
66
+ *
67
+ */
68
+ enum reboot_reason_e {
69
+ RESET_REASON_REBOOT , /**< Reboot command or sys_reset() */
70
+ RESET_REASON_NOSIM , /**< Reboot due to No SIM card */
71
+ RESET_REASON_NETWORKFAIL , /**< Reboot due to network registration failure */
72
+ RESET_REASON_DATAFAIL , /**< Reboot due to data connection failure */
73
+ RESET_REASON_FOTA , /**< Reboot due to FOTA update */
74
+ RESET_REASON_PARAMRESET , /**< Reboot due to parameter reset */
75
+ RESET_REASON_SYSFORMAT , /**< Reboot due to system memory format */
76
+ };
77
+
64
78
/**
65
79
* Unsolicited response code handler callback
66
80
* @param urc_code URC code @ref sysurc_e
@@ -69,11 +83,14 @@ enum loglevel_e {
69
83
typedef void (* urc_callback_f )(unsigned int urc_code , unsigned int urc_param );
70
84
71
85
/**
72
- * Reboot callback function called when reboot command is given
86
+ * Reboot callback function called when reboot is issued by the system.
87
+ * this callback can be used to confirm or deny reboot.
88
+ *
89
+ * @param reason [in] Reboot reason @ref reboot_reason_e
73
90
*
74
91
* @return True if reboot is allowed, false otherwise
75
92
*/
76
- typedef int (* reboot_callback_f )( void );
93
+ typedef int (* reboot_confirm_callback_f )( int reason );
77
94
78
95
/**
79
96
* Initialize Logicrom OpenCPU SDK library
@@ -111,7 +128,7 @@ void system_gettz(char *tz, int size);
111
128
* Set reboot confirm callback
112
129
* @param callback [in] Callback function pointer
113
130
*/
114
- int system_set_reboot_callback (reboot_callback_f callback );
131
+ int system_set_reboot_callback (reboot_confirm_callback_f callback );
115
132
116
133
/**
117
134
* Debug printf with debug level.
0 commit comments