typedef enum
{
RK_UPGRADE_START,
RK_UPGRADE_FINISHED,
RK_UPGRADE_ERR,
}RK_Upgrade_Status_t;
typedef void(*RK_upgrade_callback)(void *user_data, RK_Upgrade_Status_t status); //函数指针
void RK_ota_start(RK_upgrade_callback cb)
{
cb(NULL, RK_UPGRADE_START);
}
void handle_upgrade_callback_reboot(void *user_data, RK_Upgrade_Status_t status)
{
if(status == RK_UPGRADE_FINISHED){
update_ok = true;
reboot(RB_AUTOBOOT);
printf("\nupdate success\n");
}
}
int main(int argc, char **argv)
{
RK_ota_start(handle_upgrade_callback_reboot);
return 0;
}