/// Adds a new thermometer to room
///
/// # Safety
///
/// Room gets from smart_home_get_room()
///
/// * `handle`: room handle
/// * `name`: thermometer name to add
/// * `description`: thermometer description to add
/// * `server`: thermometer server to add
Adds a new thermometer to room
Adds a new thermometer to room
pub unsafe extern "C" fn smart_home_add_thermometer(
    handle: *mut Handle,
    room: *mut Room,
    name: *const c_char,
    description: *const c_char,
    server: *const c_char,
) -> *mut SmartThermometer {
    let handle = &mut *handle;
    let room = &mut *room;
    let device_name = CStr::from_ptr(name).to_str().unwrap();
    let device_description = CStr::from_ptr(description).to_str().unwrap();
    let device_server = CStr::from_ptr(server).to_str().unwrap();
    let thermometer = handle.rt.block_on(async {
        SmartThermometer::new(device_name, device_description, device_server).await
    });
    match room.add_device(thermometer) {
        Ok(thermometer) => match thermometer {
            Device::Thermometer(t) => t as *mut SmartThermometer,
            _ => unreachable!(),
        },
        Err(_) => std::ptr::null_mut(),
    }
}
pub unsafe extern " " fn smart_home_add_thermometer ( handle : * mut Handle , room : * mut Room , name : * const c_char , description : * const c_char , server : * const c_char , ) -> * mut SmartThermometer { let handle = & mut * handle ; let room = & mut * room ; let device_name = CStr :: from_ptr ( name ) . to_str ( ) . unwrap ( ) ; let device_description = CStr :: from_ptr ( description ) . to_str ( ) . unwrap ( ) ; let device_server = CStr :: from_ptr ( server ) . to_str ( ) . unwrap ( ) ; let thermometer = handle . rt . block_on ( async { SmartThermometer :: new ( device_name , device_description , device_server ) . await } ) ; match room . add_device ( thermometer ) { Ok ( thermometer ) => match thermometer { Device :: Thermometer ( t ) => t as * mut SmartThermometer , _ => unreachable ! ( ) , } , Err ( _ ) => std :: ptr :: null_mut ( ) , } }
Adds a new thermometer to room
Adds a new thermometer to room
handle
*mut Handle
room
*mut Room
name
*const c_char
description
*const c_char
server
*const c_char
safety
Room gets from smart_home_get_room()

`handle`: room handle
`name`: thermometer name to add
`description`: thermometer description to add
`server`: thermometer server to add
Room gets from smart_home_get_room () ` handle ` : room handle ` name ` : thermometer name to add ` description ` : thermometer description to add ` server ` : thermometer server to add