summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2022-01-11 10:48:41 -0800
committerKai Shi <kaishi@google.com>2022-02-14 13:26:20 -0800
commit0d51f4d7410bb9eabe5902528af62e2fc1c03211 (patch)
tree8919e2031befedf087c20ab18f5f0312a9682980 /src
parent482dbf217603ac5c79a916ea03554a0466f08027 (diff)
downloaduwb-0d51f4d7410bb9eabe5902528af62e2fc1c03211.tar.gz
Update power stats structure and add JNI command
Update power stats response data structure based on the vendor feedback. Add power stats JNI commands. Bug: 199768480 Test: atest libuwb_uci_packet_tests Change-Id: I1a99ffe895a56072bea074a6f7f5ebb2fdf357ae
Diffstat (limited to 'src')
-rw-r--r--src/rust/uci/mod.rs10
-rw-r--r--src/rust/uci_packets.pdl22
2 files changed, 13 insertions, 19 deletions
diff --git a/src/rust/uci/mod.rs b/src/rust/uci/mod.rs
index 2751df2..33634f5 100644
--- a/src/rust/uci/mod.rs
+++ b/src/rust/uci/mod.rs
@@ -32,10 +32,10 @@ use tokio::runtime::{Builder, Runtime};
use tokio::sync::{mpsc, oneshot, Notify};
use tokio::{select, task};
use uwb_uci_packets::{
- GetCapsInfoCmdBuilder, GetDeviceInfoCmdBuilder, GetDeviceInfoRspPacket, Packet,
- RangeStartCmdBuilder, RangeStopCmdBuilder, SessionDeinitCmdBuilder,
- SessionGetAppConfigCmdBuilder, SessionGetCountCmdBuilder, SessionGetStateCmdBuilder,
- SessionState, SessionStatusNtfPacket, StatusCode, UciCommandPacket,
+ AndroidGetPowerStatsCmdBuilder, GetCapsInfoCmdBuilder, GetDeviceInfoCmdBuilder,
+ GetDeviceInfoRspPacket, Packet, RangeStartCmdBuilder, RangeStopCmdBuilder,
+ SessionDeinitCmdBuilder, SessionGetAppConfigCmdBuilder, SessionGetCountCmdBuilder,
+ SessionGetStateCmdBuilder, SessionState, SessionStatusNtfPacket, StatusCode, UciCommandPacket,
};
pub type Result<T> = std::result::Result<T, UwbErr>;
@@ -85,6 +85,7 @@ pub enum JNICommand {
UciDeviceReset {
reset_config: u8,
},
+ UciGetPowerStats,
// Non blocking commands
Enable,
@@ -251,6 +252,7 @@ impl<T: EventManager> Driver<T> {
SessionDeinitCmdBuilder { session_id }.build().into()
}
JNICommand::UciSessionGetCount => SessionGetCountCmdBuilder {}.build().into(),
+ JNICommand::UciGetPowerStats => AndroidGetPowerStatsCmdBuilder {}.build().into(),
JNICommand::UciStartRange(session_id) => {
RangeStartCmdBuilder { session_id }.build().into()
}
diff --git a/src/rust/uci_packets.pdl b/src/rust/uci_packets.pdl
index 0810aa3..9eca5f8 100644
--- a/src/rust/uci_packets.pdl
+++ b/src/rust/uci_packets.pdl
@@ -752,29 +752,21 @@ test AndroidGetPowerStatsCmd {
}
struct PowerStats {
- tx_time: 32,
- tx_wake_count: 32,
- rx_time: 32,
- rx_wake_count: 32,
-}
-
-struct UwbPowerStats {
status: StatusCode,
- idle_time: 32,
- sleep_time: 32,
- ranging_stats: PowerStats,
- data_stats: PowerStats,
+ idle_time_ms: 32,
+ tx_time_ms: 32,
+ rx_time_ms: 32,
+ total_wake_count:32,
}
packet AndroidGetPowerStatsRsp : AndroidResponse (opcode = 0x0) { //ANDROID_GET_POWER_STATS
- stats: UwbPowerStats,
+ stats: PowerStats,
}
test AndroidGetPowerStatsRsp {
- "\x4e\x00\x00\x29\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ "\x4e\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
}
-
packet AndroidSetCountryCodeCmd: AndroidCommand (opcode = 0x1) { //ANDROID_SET_COUNTRY_CODE
country_code : 8[2],
}
@@ -850,4 +842,4 @@ packet UciVendor_E_Notification : UciNotification (group_id = VENDOR_RESERVED_E)
packet UciVendor_F_Notification : UciNotification (group_id = VENDOR_RESERVED_F) {
_payload_,
-} \ No newline at end of file
+}