Skip to content

Commit

Permalink
fix: driver_version response data (#52)
Browse files Browse the repository at this point in the history
Update uc-api to 0.9.1 with new media-player features and fixed
driver_version response field.
  • Loading branch information
zehnm authored Feb 27, 2024
1 parent 70979ec commit 1d015cd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uc-intg-hass"
version = "0.8.0"
version = "0.8.1"
edition = "2021"
authors = ["Markus Zehnder <[email protected]>"]
license = "MPL-2.0"
Expand Down Expand Up @@ -28,7 +28,7 @@ mdns-sd = ["dep:mdns-sd"]
zeroconf = ["dep:zeroconf"]

[dependencies]
uc_api = { git = "https://github.com/unfoldedcircle/api-model-rs", tag = "v0.8.4-beta" }
uc_api = { git = "https://github.com/unfoldedcircle/api-model-rs", tag = "v0.9.1-beta" }
# for local development:
#uc_api = { path = "../api-model-rs" }

Expand Down Expand Up @@ -73,8 +73,8 @@ time = { version = "0.3", default-features = false, features = ["std", "formatti

# Helpful macros for working with enums and strings
# Attention: strum needs to be in sync with uc_api
strum = "0.25"
strum_macros = "0.25"
strum = "0.26"
strum_macros = "0.26"
derive_more = "0.99"

anyhow = { version = "1", features = [] }
Expand Down
23 changes: 22 additions & 1 deletion src/client/service/media_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,28 @@ pub fn handle_media_player(msg: &EntityCommand) -> Result<(String, Option<Value>
| MediaPlayerCommand::FunctionBlue
| MediaPlayerCommand::Home
| MediaPlayerCommand::Menu
| MediaPlayerCommand::Back => return Err(ServiceError::BadRequest("Not supported".into())),
| MediaPlayerCommand::Back
| MediaPlayerCommand::Digit_0
| MediaPlayerCommand::Digit_1
| MediaPlayerCommand::Digit_2
| MediaPlayerCommand::Digit_3
| MediaPlayerCommand::Digit_4
| MediaPlayerCommand::Digit_5
| MediaPlayerCommand::Digit_6
| MediaPlayerCommand::Digit_7
| MediaPlayerCommand::Digit_8
| MediaPlayerCommand::Digit_9
| MediaPlayerCommand::Guide
| MediaPlayerCommand::Info
| MediaPlayerCommand::Record
| MediaPlayerCommand::MyRecordings
| MediaPlayerCommand::Live
| MediaPlayerCommand::Eject
| MediaPlayerCommand::OpenClose
| MediaPlayerCommand::AudioTrack
| MediaPlayerCommand::Subtitle => {
return Err(ServiceError::BadRequest("Not supported".into()))
}
MediaPlayerCommand::SelectSource => {
let mut data = Map::new();
let params = get_required_params(msg)?;
Expand Down
15 changes: 11 additions & 4 deletions src/controller/handler/r2_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use crate::built_info;
use crate::client::messages::{CallService, GetStates};
use crate::configuration::get_driver_metadata;
use crate::controller::handler::{
SetDriverUserDataMsg, SetupDriverMsg, SubscribeHaEventsMsg, UnsubscribeHaEventsMsg,
};
Expand All @@ -17,7 +18,7 @@ use lazy_static::lazy_static;
use log::{debug, error};
use serde_json::{json, Value};
use strum::EnumMessage;
use uc_api::intg::ws::R2Request;
use uc_api::intg::ws::{DriverVersionMsgData, R2Request};
use uc_api::intg::{EntityCommand, IntegrationVersion};
use uc_api::ws::{EventCategory, WsMessage, WsResultMsgData};

Expand Down Expand Up @@ -55,9 +56,15 @@ impl Handler<R2RequestMsg> for Controller {
R2Request::GetDriverVersion => Some(WsMessage::response(
req_id,
resp_msg,
IntegrationVersion {
api: Some(API_VERSION.to_string()),
integration: Some(APP_VERSION.to_string()),
DriverVersionMsgData {
name: get_driver_metadata()
.ok()
.and_then(|drv| drv.name)
.and_then(|name| name.get("en").cloned()),
version: Some(IntegrationVersion {
api: Some(API_VERSION.to_string()),
driver: Some(APP_VERSION.to_string()),
}),
},
)),
R2Request::GetDriverMetadata => {
Expand Down

0 comments on commit 1d015cd

Please sign in to comment.