//! Example showcasing basic usage for this library use fundamentum_edge_mcu_http_client::{ http_client_config::HttpClientConfig, models::{DeviceFQN, DeviceIdentity, Empty, HttpRequest, ProvisionResponse, RegistryFQN}, FundamentumApi, HttpClientErrorWrapper, HttpHandler, ProvisionMode, }; const REGISTRY_ACCESS_TOKEN: &str = ""; const PUBLIC_RSA_KEY: &str = ""; const SERIAL_NUMBER: &str = "serial_number_1"; const ASSET_TYPE_ID: i32 = 1; const BUFFER_SIZE: usize = 2048; struct SomeHttpHandler; #[derive(defmt::Format)] struct SomeHttpHandlerError; impl HttpHandler for SomeHttpHandler { type Error = SomeHttpHandlerError; async fn http_call<'a, 'd>( &'a self, _request: HttpRequest<'_>, _out_buffer: &'d mut [u8], ) -> Result<(), Self::Error> { Ok(()) } } #[tokio::main] async fn main() { // Setup device and registry let device_fqn = DeviceFQN { registry_fqn: RegistryFQN { project_id: 1, region_id: 1, registry_id: 1, }, serial_number: SERIAL_NUMBER, }; // Initialize the Fundamentum API access point let api = FundamentumApi::new(HttpClientConfig::default(), SomeHttpHandler); let mut response_buffer = [0; BUFFER_SIZE]; let device_identity = DeviceIdentity::Rsa256 { public_key: PUBLIC_RSA_KEY, }; // Perform the provisioning call on the [`HttpHandler`] let _provision_result: Result< ProvisionResponse, HttpClientErrorWrapper<'_, SomeHttpHandler>, > = api .provisioning_api() .provision( &device_fqn, ASSET_TYPE_ID, REGISTRY_ACCESS_TOKEN, &device_identity, ProvisionMode::Normal, &mut response_buffer, ) .await; }