From c3f3ecdb8377a94a9346c6ea813b8b9a21a4fb5e Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Fri, 19 May 2023 16:18:30 +0700 Subject: [PATCH] Use the right method for fcm --- crates/core/src/bc_protocol/pushinfo.rs | 8 ++++---- crates/pushnoti/README.md | 27 +++++++++++++++++++++++++ crates/pushnoti/src/main.rs | 4 ++-- dissector/baichuan.lua | 2 ++ 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/crates/core/src/bc_protocol/pushinfo.rs b/crates/core/src/bc_protocol/pushinfo.rs index 66c07bc..ab8851c 100644 --- a/crates/core/src/bc_protocol/pushinfo.rs +++ b/crates/core/src/bc_protocol/pushinfo.rs @@ -10,13 +10,13 @@ pub enum PhoneType { /// Specify that this is an andriod push notfication /// /// In this case the token must firebase cloud messaging token - Andriod, + Android, } impl BcCamera { /// Convenience method for andriod of `[send_pushinfo]` - pub async fn send_pushinfo_andriod(&self, token: &str, client_id: &str) -> Result<()> { - self.send_pushinfo(token, client_id, PhoneType::Andriod) + pub async fn send_pushinfo_android(&self, token: &str, client_id: &str) -> Result<()> { + self.send_pushinfo(token, client_id, PhoneType::Android) .await } /// Convenience method for andriod of `[send_pushinfo]` @@ -36,7 +36,7 @@ impl BcCamera { let phone_type_str = match phone_type { PhoneType::Ios => "reo_iphone", - PhoneType::Andriod => "reo_fcm", + PhoneType::Android => "reo_fcm", }; let msg = Bc { diff --git a/crates/pushnoti/README.md b/crates/pushnoti/README.md index 40eeab1..55a569b 100644 --- a/crates/pushnoti/README.md +++ b/crates/pushnoti/README.md @@ -202,3 +202,30 @@ We can use the `https://pushx.reolink.com/listeners//devices` api to confirm if our client is regeristed for push notifications. Which was the next thing to do once we passed the token onto the camera + +--- + +On motion reolink will send the following json + +```json +{ + "data": { + "SRVTIME": "2023-05-19T08:07:03.566Z", + "ALMNAME": "Motion Alert from Cam01", + "sound": "push.wav", + "CHNAME": "Cam0", + "messageType": "alarm", + "DEVNAME": "Cam01", + "pushVersion": "v1.1", + "UID": "REDACTED", + "ALMTYPE": "MD", + "ALMCHN": "1", + "alert": "Motion Alert from Cam01", + "title": "Camera Alert" + }, + "from": "743639030586", + "priority": "normal", + "notification": { "title": "Camera Alert", "body": "Motion Alert from Cam01" }, + "fcmMessageId": "REDACTED" +} +``` diff --git a/crates/pushnoti/src/main.rs b/crates/pushnoti/src/main.rs index 1beef79..d9e5bfd 100644 --- a/crates/pushnoti/src/main.rs +++ b/crates/pushnoti/src/main.rs @@ -65,7 +65,7 @@ async fn main() -> Result<()> { info!("registration.fcm_token: {}", registration.fcm_token); let uid = "6A5443E486511B0D828543445DC55A7D"; // MD5 Hash of "WHY_REOLINK" camera - .send_pushinfo_ios(®istration.fcm_token, uid) + .send_pushinfo_android(®istration.fcm_token, uid) .await?; info!("Listening"); @@ -75,7 +75,7 @@ async fn main() -> Result<()> { info!("Message JSON: {}", message.payload_json); info!("Persistent ID: {:?}", message.persistent_id); }, - vec!["1:696841269229:ios:695029b18debb23e".to_owned()], + vec![], ); listener.connect().await?; Ok(()) diff --git a/dissector/baichuan.lua b/dissector/baichuan.lua index 7f95220..8b781f4 100644 --- a/dissector/baichuan.lua +++ b/dissector/baichuan.lua @@ -149,6 +149,7 @@ local message_types = { [109]="", [114]="", [115]="", + [116]="", [120]="", [122]="", [123]="", @@ -162,6 +163,7 @@ local message_types = { [151]="", [190]="PTZ Preset", [194]=" (test)", + [195]="", [199]="", [208]="", [209]=" (write)",