Ready to implement sync function on ESP32 device
This commit is contained in:
		@@ -164,7 +164,23 @@ void app_main(void)
 | 
				
			|||||||
    ESP_LOGI(TAG, "Current device certificate:\n%s", dev_certificate);
 | 
					    ESP_LOGI(TAG, "Current device certificate:\n%s", dev_certificate);
 | 
				
			||||||
    free(dev_certificate);
 | 
					    free(dev_certificate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Main loop
 | 
				
			||||||
    ESP_LOGI(TAG, "Starting main loop");
 | 
					    ESP_LOGI(TAG, "Starting main loop");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while (true)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (!secure_api_sync_device())
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ESP_LOGE(TAG, "Failed to synchronise device!");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ESP_LOGI(TAG, "Successfully synchronised device!");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        system_sleep(10);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    system_sleep(120);
 | 
					    system_sleep(120);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    reboot();
 | 
					    reboot();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -192,4 +192,10 @@ char *secure_api_get_dev_certificate()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return res;
 | 
					    return res;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void *secure_api_sync_device()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    printf("here implement sync device logic\n");
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -40,6 +40,13 @@ extern "C"
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    char *secure_api_get_dev_certificate();
 | 
					    char *secure_api_get_dev_certificate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Synchronise device with central backend
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Returns NULL in case of failure
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void *secure_api_sync_device();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user