pub struct ThreadControllerImpl { /* private fields */ }Expand description
Thread controller implementation.
This is the main implementation of the ThreadController trait.
It manages device threads and provides methods for device operations.
Thread controller implementation.
This is the main implementation of the ThreadController trait.
It manages device threads and provides methods for device operations.
Implementations§
Source§impl ThreadControllerImpl
impl ThreadControllerImpl
Sourcepub fn with_logger(logger: Arc<dyn Logger>) -> Self
pub fn with_logger(logger: Arc<dyn Logger>) -> Self
Sourcepub fn set_default_refresh_interval(&mut self, interval_ms: u64)
pub fn set_default_refresh_interval(&mut self, interval_ms: u64)
Sourcepub fn set_logger(&mut self, logger: Arc<dyn Logger>)
pub fn set_logger(&mut self, logger: Arc<dyn Logger>)
Trait Implementations§
Source§impl Default for ThreadControllerImpl
impl Default for ThreadControllerImpl
Source§impl DeviceOperations for ThreadControllerImpl
impl DeviceOperations for ThreadControllerImpl
Source§fn set_digital_output(
&self,
thread_id: u32,
pin: u32,
value: bool,
) -> Result<()>
fn set_digital_output( &self, thread_id: u32, pin: u32, value: bool, ) -> Result<()>
Set a digital output pin. Read more
Source§fn get_digital_input(&self, thread_id: u32, pin: u32) -> Result<bool>
fn get_digital_input(&self, thread_id: u32, pin: u32) -> Result<bool>
Get a digital input pin. Read more
Source§fn set_analog_output(&self, thread_id: u32, pin: u32, value: u32) -> Result<()>
fn set_analog_output(&self, thread_id: u32, pin: u32, value: u32) -> Result<()>
Set an analog output. Read more
Source§fn get_analog_input(&self, thread_id: u32, pin: u32) -> Result<u32>
fn get_analog_input(&self, thread_id: u32, pin: u32) -> Result<u32>
Get an analog input. Read more
Source§fn set_pwm_duty_cycle(
&self,
thread_id: u32,
channel: usize,
duty: u32,
) -> Result<()>
fn set_pwm_duty_cycle( &self, thread_id: u32, channel: usize, duty: u32, ) -> Result<()>
Set a PWM duty cycle. Read more
Source§fn set_pwm_duty_cycle_percent(
&self,
thread_id: u32,
channel: usize,
duty_percent: f32,
) -> Result<()>
fn set_pwm_duty_cycle_percent( &self, thread_id: u32, channel: usize, duty_percent: f32, ) -> Result<()>
Set a PWM duty cycle as a percentage. Read more
Source§fn configure_servo(
&self,
thread_id: u32,
pin: u8,
servo_config: ServoConfig,
) -> Result<()>
fn configure_servo( &self, thread_id: u32, pin: u8, servo_config: ServoConfig, ) -> Result<()>
Configure a servo on a PWM pin. Read more
Source§fn set_servo_angle(&self, thread_id: u32, pin: u8, angle: f32) -> Result<()>
fn set_servo_angle(&self, thread_id: u32, pin: u8, angle: f32) -> Result<()>
Set servo angle (for 180° and 360° position servos). Read more
Source§fn set_servo_speed(&self, thread_id: u32, pin: u8, speed: f32) -> Result<()>
fn set_servo_speed(&self, thread_id: u32, pin: u8, speed: f32) -> Result<()>
Set servo speed (for 360° speed servos). Read more
Source§fn stop_servo(&self, thread_id: u32, pin: u8) -> Result<()>
fn stop_servo(&self, thread_id: u32, pin: u8) -> Result<()>
Stop a servo (set to neutral position). Read more
Source§fn i2c_write(&self, thread_id: u32, address: u8, data: Vec<u8>) -> Result<()>
fn i2c_write(&self, thread_id: u32, address: u8, data: Vec<u8>) -> Result<()>
Write data to an I2C device. Read more
Source§fn i2c_read(&self, thread_id: u32, address: u8, length: u8) -> Result<Vec<u8>>
fn i2c_read(&self, thread_id: u32, address: u8, length: u8) -> Result<Vec<u8>>
Read data from an I2C device. Read more
Source§fn i2c_write_read(
&self,
thread_id: u32,
address: u8,
write_data: Vec<u8>,
read_length: u8,
) -> Result<Vec<u8>>
fn i2c_write_read( &self, thread_id: u32, address: u8, write_data: Vec<u8>, read_length: u8, ) -> Result<Vec<u8>>
Write then read from an I2C device (combined operation). Read more
Source§fn i2c_scan(&self, thread_id: u32) -> Result<Vec<u8>>
fn i2c_scan(&self, thread_id: u32) -> Result<Vec<u8>>
Scan for I2C devices on the bus. Read more
Source§fn configure_uspibridge(
&self,
thread_id: u32,
config: USPIBridgeConfig,
) -> Result<()>
fn configure_uspibridge( &self, thread_id: u32, config: USPIBridgeConfig, ) -> Result<()>
Configure uSPIBridge with custom pinout. Read more
Source§fn uspibridge_command(
&self,
thread_id: u32,
command: Vec<u8>,
) -> Result<Vec<u8>>
fn uspibridge_command( &self, thread_id: u32, command: Vec<u8>, ) -> Result<Vec<u8>>
Send uSPIBridge command. Read more
Source§fn check_pin_capability(
&self,
thread_id: u32,
pin: u8,
capability: PinCapability,
) -> Result<bool>
fn check_pin_capability( &self, thread_id: u32, pin: u8, capability: PinCapability, ) -> Result<bool>
Check if a pin supports a specific capability. Read more
Source§fn get_device_model(&self, thread_id: u32) -> Result<Option<String>>
fn get_device_model(&self, thread_id: u32) -> Result<Option<String>>
Get device model information. Read more
Source§fn validate_pin_operation(
&self,
thread_id: u32,
pin: u8,
operation: &str,
) -> Result<()>
fn validate_pin_operation( &self, thread_id: u32, pin: u8, operation: &str, ) -> Result<()>
Validate pin configuration before operation. Read more
Source§fn set_digital_outputs_bulk(
&self,
thread_id: u32,
pin_states: Vec<(u32, bool)>,
) -> Result<()>
fn set_digital_outputs_bulk( &self, thread_id: u32, pin_states: Vec<(u32, bool)>, ) -> Result<()>
Set multiple digital outputs in a single operation. Read more
Source§fn set_pwm_duties_bulk(
&self,
thread_id: u32,
channel_duties: Vec<(usize, u32)>,
) -> Result<()>
fn set_pwm_duties_bulk( &self, thread_id: u32, channel_duties: Vec<(usize, u32)>, ) -> Result<()>
Set multiple PWM duty cycles in a single operation. Read more
Source§fn read_analog_inputs_bulk(
&self,
thread_id: u32,
pins: Vec<u32>,
) -> Result<Vec<u32>>
fn read_analog_inputs_bulk( &self, thread_id: u32, pins: Vec<u32>, ) -> Result<Vec<u32>>
Read multiple analog inputs in a single operation. Read more
Source§fn get_encoder_value(&self, thread_id: u32, encoder_index: u32) -> Result<i32>
fn get_encoder_value(&self, thread_id: u32, encoder_index: u32) -> Result<i32>
Get an encoder value. Read more
Source§fn configure_encoder(
&self,
thread_id: u32,
encoder_index: u32,
pin_a: u32,
pin_b: u32,
enabled: bool,
sampling_4x: bool,
) -> Result<()>
fn configure_encoder( &self, thread_id: u32, encoder_index: u32, pin_a: u32, pin_b: u32, enabled: bool, sampling_4x: bool, ) -> Result<()>
Configure an encoder. Read more
Source§fn reset_digital_counter(&self, thread_id: u32, pin: u32) -> Result<()>
fn reset_digital_counter(&self, thread_id: u32, pin: u32) -> Result<()>
Reset a digital counter. Read more
Source§fn send_custom_request(
&self,
thread_id: u32,
request_type: u8,
param1: u8,
param2: u8,
param3: u8,
param4: u8,
) -> Result<()>
fn send_custom_request( &self, thread_id: u32, request_type: u8, param1: u8, param2: u8, param3: u8, param4: u8, ) -> Result<()>
Send a custom request. Read more
Source§fn set_pin_function(
&self,
thread_id: u32,
pin: u32,
pin_function: PinFunction,
) -> Result<()>
fn set_pin_function( &self, thread_id: u32, pin: u32, pin_function: PinFunction, ) -> Result<()>
Configure a pin function. Read more
Source§impl Drop for ThreadControllerImpl
impl Drop for ThreadControllerImpl
Source§impl ThreadController for ThreadControllerImpl
impl ThreadController for ThreadControllerImpl
Source§fn discover_usb_devices(&mut self) -> Result<Vec<u32>>
fn discover_usb_devices(&mut self) -> Result<Vec<u32>>
Discover USB devices connected to the system. Read more
Source§fn discover_network_devices(
&mut self,
timeout_ms: u32,
) -> Result<Vec<NetworkDeviceSummary>>
fn discover_network_devices( &mut self, timeout_ms: u32, ) -> Result<Vec<NetworkDeviceSummary>>
Discover network devices on the local network. Read more
Source§fn start_usb_device_thread(&mut self, device_index: u32) -> Result<u32>
fn start_usb_device_thread(&mut self, device_index: u32) -> Result<u32>
Start a thread for a USB device. Read more
Source§fn start_network_device_thread(
&mut self,
device_summary: NetworkDeviceSummary,
) -> Result<u32>
fn start_network_device_thread( &mut self, device_summary: NetworkDeviceSummary, ) -> Result<u32>
Start a thread for a network device. Read more
Source§fn start_device_thread_by_serial(
&mut self,
serial_number: u32,
check_network: bool,
timeout_ms: u32,
) -> Result<u32>
fn start_device_thread_by_serial( &mut self, serial_number: u32, check_network: bool, timeout_ms: u32, ) -> Result<u32>
Start a thread for a device with a specific serial number. Read more
Source§fn send_command(&self, thread_id: u32, command: DeviceCommand) -> Result<()>
fn send_command(&self, thread_id: u32, command: DeviceCommand) -> Result<()>
Send a command to a device thread. Read more
Source§fn get_status(&self, thread_id: u32) -> Result<ThreadStatus>
fn get_status(&self, thread_id: u32) -> Result<ThreadStatus>
Get the status of a device thread. Read more
Source§fn get_state(&self, thread_id: u32) -> Result<DeviceState>
fn get_state(&self, thread_id: u32) -> Result<DeviceState>
Get the state of a device thread. Read more
Get the shared state of a device thread. Read more
Source§fn create_observer(&self, thread_id: u32) -> Result<StateObserver>
fn create_observer(&self, thread_id: u32) -> Result<StateObserver>
Create a state observer for a device thread. Read more
Source§fn set_thread_log_level(
&mut self,
thread_id: u32,
level: LevelFilter,
) -> Result<()>
fn set_thread_log_level( &mut self, thread_id: u32, level: LevelFilter, ) -> Result<()>
Set the log level for a specific thread. Read more
Source§fn set_global_log_level(&mut self, level: LevelFilter) -> Result<()>
fn set_global_log_level(&mut self, level: LevelFilter) -> Result<()>
Set the log level for all threads and the controller. Read more
Source§fn start_model_monitoring(
&mut self,
thread_id: u32,
model_dir: Option<PathBuf>,
) -> Result<()>
fn start_model_monitoring( &mut self, thread_id: u32, model_dir: Option<PathBuf>, ) -> Result<()>
Start model monitoring for a device thread. Read more
Source§fn stop_model_monitoring(&mut self, thread_id: u32) -> Result<()>
fn stop_model_monitoring(&mut self, thread_id: u32) -> Result<()>
Stop model monitoring for a device thread. Read more
Source§fn update_device_model(&self, thread_id: u32, model: DeviceModel) -> Result<()>
fn update_device_model(&self, thread_id: u32, model: DeviceModel) -> Result<()>
Update the device model for a thread. Read more
Auto Trait Implementations§
impl Freeze for ThreadControllerImpl
impl !RefUnwindSafe for ThreadControllerImpl
impl !Send for ThreadControllerImpl
impl !Sync for ThreadControllerImpl
impl Unpin for ThreadControllerImpl
impl !UnwindSafe for ThreadControllerImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more