Constructor for uwb echip and accept uwb connector from cuttlefish

mac_address can be accepted with the provided chip_address

0.0.0.0:6520  position: 0.00, 0.00, 0.00
  ble:     up       | rx_count:         0 | tx_count:         0
  classic: up       | rx_count:         0 | tx_count:         0
  uwb:     unknown  | rx_count:         0 | tx_count:         0

Test: launch_cvd --netsim_uwb && netsim devices
Test: atest --host-unit-test-only --test-filter netsim
Bug: 321790942
Change-Id: I4e17cede9b16d5f2334cdbcf6708a908b246a04a
diff --git a/rust/daemon/src/devices/devices_handler.rs b/rust/daemon/src/devices/devices_handler.rs
index dc96d5a..35c2818 100644
--- a/rust/daemon/src/devices/devices_handler.rs
+++ b/rust/daemon/src/devices/devices_handler.rs
@@ -229,7 +229,10 @@
             }),
         ),
         "WIFI" => (ProtoChipKind::WIFI, echip::CreateParam::Wifi(echip::wifi::CreateParams {})),
-        "UWB" => (ProtoChipKind::UWB, echip::CreateParam::Uwb),
+        "UWB" => (
+            ProtoChipKind::UWB,
+            echip::CreateParam::Uwb(echip::uwb::CreateParams { address: chip_address.to_string() }),
+        ),
         _ => {
             return Box::new(AddChipResultCxx {
                 device_id: u32::MAX,
diff --git a/rust/daemon/src/echip/emulated_chip.rs b/rust/daemon/src/echip/emulated_chip.rs
index a7153ea..651dbaa 100644
--- a/rust/daemon/src/echip/emulated_chip.rs
+++ b/rust/daemon/src/echip/emulated_chip.rs
@@ -31,7 +31,7 @@
 pub struct SharedEmulatedChip(pub Arc<Mutex<Box<dyn EmulatedChip + Send + Sync>>>);
 
 #[cfg(not(test))]
-use crate::echip::{bluetooth, wifi};
+use crate::echip::{bluetooth, uwb, wifi};
 
 // ECHIPS is a singleton that contains a hash map from
 // ChipIdentifier to SharedEmulatedChip
@@ -54,7 +54,8 @@
     Bluetooth(bluetooth::CreateParams),
     #[cfg(not(test))]
     Wifi(wifi::CreateParams),
-    Uwb,
+    #[cfg(not(test))]
+    Uwb(uwb::CreateParams),
     Mock(mocked::CreateParams),
 }
 
@@ -119,7 +120,8 @@
         CreateParam::Bluetooth(params) => bluetooth::new(params, chip_id),
         #[cfg(not(test))]
         CreateParam::Wifi(params) => wifi::new(params, chip_id),
-        CreateParam::Uwb => todo!(),
+        #[cfg(not(test))]
+        CreateParam::Uwb(params) => uwb::new(params, chip_id),
         CreateParam::Mock(params) => mocked::new(params, chip_id),
     };
 
diff --git a/rust/daemon/src/echip/mod.rs b/rust/daemon/src/echip/mod.rs
index f2284d9..a965b74 100644
--- a/rust/daemon/src/echip/mod.rs
+++ b/rust/daemon/src/echip/mod.rs
@@ -21,7 +21,7 @@
 
 // TODO: Remove the allow block once it's stitched with pica library
 #[allow(dead_code, unused_variables)]
-mod uwb;
+pub mod uwb;
 
 pub use crate::echip::emulated_chip::CreateParam;
 pub use crate::echip::emulated_chip::EmulatedChip;
diff --git a/rust/daemon/src/echip/uwb.rs b/rust/daemon/src/echip/uwb.rs
index edc0dcf..a9612d4 100644
--- a/rust/daemon/src/echip/uwb.rs
+++ b/rust/daemon/src/echip/uwb.rs
@@ -12,8 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+use netsim_proto::model::chip::Radio;
 use netsim_proto::model::Chip as ProtoChip;
-use netsim_proto::stats::NetsimRadioStats as ProtoRadioStats;
+use netsim_proto::stats::{netsim_radio_stats, NetsimRadioStats as ProtoRadioStats};
+
+use std::sync::{Arc, Mutex};
 
 use crate::devices::chip::ChipIdentifier;
 
@@ -27,7 +30,7 @@
 
 /// Parameters for creating UWB chips
 pub struct CreateParams {
-    mac_address: u64,
+    pub address: String,
 }
 
 /// UWB struct will keep track of pica_id
@@ -37,46 +40,59 @@
 
 impl EmulatedChip for Uwb {
     fn handle_request(&self, packet: &[u8]) {
-        todo!()
+        log::info!("{packet:?}");
     }
 
     fn reset(&mut self) {
-        todo!()
+        // TODO(b/321790942): Reset chip state in pica
+        log::info!("Reset Uwb Chip for pica_id: {}", self.pica_id)
     }
 
     fn get(&self) -> ProtoChip {
-        todo!()
+        let mut chip_proto = ProtoChip::new();
+        // TODO(b/321790942): Get the chip state from pica
+        let uwb_proto = Radio::new();
+        chip_proto.mut_uwb().clone_from(&uwb_proto);
+        chip_proto
     }
 
     fn patch(&mut self, chip: &ProtoChip) {
-        todo!()
+        // TODO(b/321790942): Patch the chip state through pica
+        log::info!("Patch Uwb Chip for pica_id: {}", self.pica_id);
     }
 
     fn remove(&mut self) {
-        todo!()
+        // TODO(b/321790942): Remove the chip information from pica
+        log::info!("Remove Uwb Chip for pica_id: {}", self.pica_id);
     }
 
     fn get_stats(&self, duration_secs: u64) -> Vec<ProtoRadioStats> {
-        todo!()
+        let mut stats_proto = ProtoRadioStats::new();
+        stats_proto.set_duration_secs(duration_secs);
+        stats_proto.set_kind(netsim_radio_stats::Kind::UWB);
+        vec![stats_proto]
     }
 }
 
 pub fn new(create_params: &CreateParams, chip_id: ChipIdentifier) -> SharedEmulatedChip {
-    todo!()
+    // TODO(b/321790942): Add the device into pica and obtain the pica identifier
+    let echip = Uwb { pica_id: chip_id };
+    SharedEmulatedChip(Arc::new(Mutex::new(Box::new(echip))))
 }
 
 #[cfg(test)]
 mod tests {
-    #[ignore = "TODO: Perform new and check SharedEmulatedChip"]
-    #[test]
-    fn test_new() {
-        todo!();
+
+    use super::*;
+
+    fn new_uwb_shared_echip() -> SharedEmulatedChip {
+        new(&CreateParams { address: "test".to_string() }, 0)
     }
 
-    #[ignore = "TODO: Check if get properly returns a Chip protobuf"]
     #[test]
     fn test_uwb_get() {
-        todo!()
+        let shared_echip = new_uwb_shared_echip();
+        assert!(shared_echip.lock().get().has_uwb());
     }
 
     #[ignore = "TODO: Check if reset properly sets the state to true"]
@@ -85,9 +101,12 @@
         todo!()
     }
 
-    #[ignore = "TODO: Check if get_stats returns the proper ProtoRadioStats"]
     #[test]
     fn test_get_stats() {
-        todo!()
+        let shared_echip = new_uwb_shared_echip();
+        let radio_stat_vec = shared_echip.lock().get_stats(0);
+        let radio_stat = radio_stat_vec.get(0).unwrap();
+        assert_eq!(radio_stat.kind(), netsim_radio_stats::Kind::UWB);
+        assert_eq!(radio_stat.duration_secs(), 0);
     }
 }
diff --git a/rust/daemon/src/transport/fd.rs b/rust/daemon/src/transport/fd.rs
index 2e7dac4..654cd52 100644
--- a/rust/daemon/src/transport/fd.rs
+++ b/rust/daemon/src/transport/fd.rs
@@ -199,7 +199,9 @@
                             })
                         }
                         ChipKind::WIFI => echip::CreateParam::Wifi(echip::wifi::CreateParams {}),
-                        ChipKind::UWB => echip::CreateParam::Uwb,
+                        ChipKind::UWB => echip::CreateParam::Uwb(echip::uwb::CreateParams {
+                            address: chip.address.clone().unwrap_or_default(),
+                        }),
                         _ => {
                             warn!("The provided chip kind is unsupported: {:?}", chip.kind);
                             return;