Mise en place d'une macro pour la définition des variables
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static A_ARG_TYPE_INSTANCE_ID: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
Arc::new(StateVariable::new(StateVarType::UI4, "A_ARG_TYPE_InstanceID".to_string()))
|
||||
});
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_INSTANCE_ID: UI4 = "A_ARG_TYPE_InstanceID"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static A_ARG_TYPE_PLAY_SPEED: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
Arc::new(StateVariable::new(StateVarType::String, "A_ARG_TYPE_PlaySpeed".to_string()))
|
||||
});
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_PLAY_SPEED: String = "A_ARG_TYPE_PlaySpeed"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static A_ARG_TYPE_SEEKMODE: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "A_ARG_TYPE_SeekMode".to_string());
|
||||
|
||||
sv.extend_allowed_values(&[
|
||||
StateValue::String("TRACK_NR".to_string()),
|
||||
StateValue::String("REL_TIME".to_string()),
|
||||
StateValue::String("ABS_TIME".to_string()),
|
||||
]).expect("Cannot set allowed values");
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_SEEKMODE: String = "A_ARG_TYPE_SeekMode" {
|
||||
allowed: ["TRACK_NR", "REL_TIME", "ABS_TIME"],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
define_variable! {
|
||||
pub static AVTRANSPORTURI: String = "AVTransportURI"
|
||||
}
|
||||
|
||||
pub static AVTRANSPORTURI: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
Arc::new(StateVariable::new(StateVarType::String, "AVTransportURI".to_string()))
|
||||
});
|
||||
|
||||
pub static AVTRANSPORTNEXTURI: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
Arc::new(StateVariable::new(StateVarType::String, "AVTransportNextURI".to_string()))
|
||||
});
|
||||
define_variable! {
|
||||
pub static AVTRANSPORTNEXTURI: String = "AVTransportNextURI"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static CURRENTMEDIADURATION: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let sv = StateVariable::new(StateVarType::String, "CurrentMediaDuration".to_string());
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static CURRENTMEDIADURATION: String = "CurrentMediaDuration"
|
||||
}
|
||||
|
||||
@@ -1,24 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static CURRENTPLAYMODE: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "CurrentPlayMode".to_string());
|
||||
|
||||
sv.extend_allowed_values(&[
|
||||
StateValue::String("NORMAL".to_string()),
|
||||
StateValue::String("SHUFFLE".to_string()),
|
||||
StateValue::String("REPEAT_ONE".to_string()),
|
||||
StateValue::String("REPEAT_ALL".to_string()),
|
||||
StateValue::String("RANDOM".to_string()),
|
||||
StateValue::String("DIRECT_1".to_string()),
|
||||
StateValue::String("INTRO".to_string()),
|
||||
]).expect("Cannot set allowed values");
|
||||
|
||||
sv.set_default(&StateValue::String("NORMAL".to_string()))
|
||||
.expect("Cannot set default value");
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static CURRENTPLAYMODE: String = "CurrentPlayMode" {
|
||||
allowed: ["NORMAL", "SHUFFLE", "REPEAT_ONE", "REPEAT_ALL", "RANDOM", "DIRECT_1", "INTRO"],
|
||||
default: "NORMAL",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static CURRENTTRACKMETADATA: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let sv = StateVariable::new(StateVarType::String, "CurrentTrackMetaData".to_string());
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static CURRENTTRACKMETADATA: String = "CurrentTrackMetaData"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static CURRENTTRACKURI: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let sv = StateVariable::new(StateVarType::String, "CurrentTrackURI".to_string());
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static CURRENTTRACKURI: String = "CurrentTrackURI"
|
||||
}
|
||||
|
||||
@@ -1,28 +1,12 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static PLAYBACKSTORAGEMEDIUM: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "PlaybackStorageMedium".to_string());
|
||||
|
||||
// Valeurs pour un MediaRenderer audio uniquement (suppression des formats vidéo)
|
||||
sv.extend_allowed_values(&[
|
||||
StateValue::String("UNKNOWN".to_string()),
|
||||
StateValue::String("CD-ROM".to_string()),
|
||||
StateValue::String("CD-DA".to_string()),
|
||||
StateValue::String("CD-R".to_string()),
|
||||
StateValue::String("CD-RW".to_string()),
|
||||
StateValue::String("SACD".to_string()),
|
||||
StateValue::String("MD-AUDIO".to_string()),
|
||||
StateValue::String("DVD-AUDIO".to_string()),
|
||||
StateValue::String("DAT".to_string()),
|
||||
StateValue::String("HDD".to_string()),
|
||||
StateValue::String("NETWORK".to_string()),
|
||||
StateValue::String("NONE".to_string()),
|
||||
StateValue::String("NOT_IMPLEMENTED".to_string()),
|
||||
]).expect("Cannot set allowed values");
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
// Valeurs pour un MediaRenderer audio uniquement (suppression des formats vidéo)
|
||||
define_variable! {
|
||||
pub static PLAYBACKSTORAGEMEDIUM: String = "PlaybackStorageMedium" {
|
||||
allowed: [
|
||||
"UNKNOWN", "CD-ROM", "CD-DA", "CD-R", "CD-RW", "SACD",
|
||||
"MD-AUDIO", "DVD-AUDIO", "DAT", "HDD", "NETWORK",
|
||||
"NONE", "NOT_IMPLEMENTED"
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static POSSIBLEPLAYBACKSTORAGEMEDIA: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let sv = StateVariable::new(StateVarType::String, "PossiblePlaybackStorageMedia".to_string());
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static POSSIBLEPLAYBACKSTORAGEMEDIA: String = "PossiblePlaybackStorageMedia"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static SEEKMODE: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
Arc::new(StateVariable::new(StateVarType::String, "SeekMode".to_string()))
|
||||
});
|
||||
define_variable! {
|
||||
pub static SEEKMODE: String = "SeekMode"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
define_variable! {
|
||||
pub static CURRENTTRACK: String = "CurrentTrack" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub static CURRENTTRACK: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "CurrentTrack".to_string());
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
|
||||
pub static NUMBEROFTRACKS: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "NumberOfTracks".to_string());
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static NUMBEROFTRACKS: String = "NumberOfTracks" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::StateVarType;
|
||||
use once_cell::sync::Lazy;
|
||||
define_variable! {
|
||||
pub static CURRENTTRACKDURATION: String = "CurrentTrackDuration" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub static CURRENTTRACKDURATION: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "CurrentTrackDuration".to_string());
|
||||
define_variable! {
|
||||
pub static ABSOLUTETIMEPOSITION: String = "AbsoluteTimePosition" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
|
||||
pub static ABSOLUTETIMEPOSITION: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "AbsoluteTimePosition".to_string());
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
|
||||
pub static RELATIVETIMEPOSITION: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "RelativeTimePosition".to_string());
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static RELATIVETIMEPOSITION: String = "RelativeTimePosition" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static TRANSPORTPLAYSPEED: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "TransportPlaySpeed".to_string());
|
||||
|
||||
sv.push_allowed_value(&StateValue::String("1".to_string())).expect("Cannot add allowed value");
|
||||
sv.set_default(&StateValue::String("1".to_string())).expect("Cannt set default value");
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static TRANSPORTPLAYSPEED: String = "TransportPlaySpeed" {
|
||||
allowed: ["1"],
|
||||
default: "1",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,10 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static TRANSPORTSTATE: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "TransportState".to_string());
|
||||
|
||||
// États pour un MediaRenderer audio uniquement (suppression des états d'enregistrement)
|
||||
sv.extend_allowed_values(&[
|
||||
StateValue::String("STOPPED".to_string()),
|
||||
StateValue::String("PLAYING".to_string()),
|
||||
StateValue::String("TRANSITIONING".to_string()),
|
||||
StateValue::String("PAUSED_PLAYBACK".to_string()),
|
||||
StateValue::String("NO_MEDIA_PRESENT".to_string()),
|
||||
]).expect("Cannot set allowed values");
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
// États pour un MediaRenderer audio uniquement (suppression des états d'enregistrement)
|
||||
define_variable! {
|
||||
pub static TRANSPORTSTATE: String = "TransportState" {
|
||||
allowed: ["STOPPED", "PLAYING", "TRANSITIONING", "PAUSED_PLAYBACK", "NO_MEDIA_PRESENT"],
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
use crate::define_variable;
|
||||
|
||||
use crate::state_variables::StateVariable;
|
||||
use crate::variable_types::{StateValue, StateVarType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
pub static TRANSPORTSTATUS: Lazy<Arc<StateVariable>> = Lazy::new(|| -> Arc<StateVariable> {
|
||||
let mut sv = StateVariable::new(StateVarType::String, "TransportStatus".to_string());
|
||||
|
||||
sv.extend_allowed_values(&[
|
||||
StateValue::String("OK".to_string()),
|
||||
StateValue::String("ERROR_OCCURRED".to_string()),
|
||||
])
|
||||
.expect("Cannt set default value");
|
||||
|
||||
sv.set_send_notification();
|
||||
|
||||
Arc::new(sv)
|
||||
});
|
||||
define_variable! {
|
||||
pub static TRANSPORTSTATUS: String = "TransportStatus" {
|
||||
allowed: ["OK", "ERROR_OCCURRED"],
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
|
||||
172
pmoupnp/src/state_variables/macros.rs
Normal file
172
pmoupnp/src/state_variables/macros.rs
Normal file
@@ -0,0 +1,172 @@
|
||||
/// Macro pour définir facilement une variable d'état UPnP.
|
||||
///
|
||||
/// Cette macro simplifie la création de variables d'état UPnP statiques en générant
|
||||
/// automatiquement le code nécessaire pour initialiser une variable avec ses propriétés.
|
||||
///
|
||||
/// # Syntaxe
|
||||
///
|
||||
/// ## Variable simple (sans valeurs autorisées)
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_variable! {
|
||||
/// pub static VAR_NAME: Type = "VariableName"
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Variable avec valeurs autorisées (enum)
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_variable! {
|
||||
/// pub static VAR_NAME: String = "VariableName" {
|
||||
/// allowed: ["Value1", "Value2", "Value3"],
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Variable avec valeur par défaut
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_variable! {
|
||||
/// pub static VAR_NAME: String = "VariableName" {
|
||||
/// allowed: ["Value1", "Value2"],
|
||||
/// default: "Value1",
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Variable avec notification d'événements
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_variable! {
|
||||
/// pub static VAR_NAME: String = "VariableName" {
|
||||
/// allowed: ["STOPPED", "PLAYING"],
|
||||
/// evented: true,
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ## Variable avec toutes les options
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_variable! {
|
||||
/// pub static VAR_NAME: String = "VariableName" {
|
||||
/// allowed: ["Value1", "Value2", "Value3"],
|
||||
/// default: "Value1",
|
||||
/// evented: true,
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Types supportés
|
||||
///
|
||||
/// - `String` : Chaîne de caractères
|
||||
/// - `UI1`, `UI2`, `UI4` : Entiers non signés
|
||||
/// - `I1`, `I2`, `I4` : Entiers signés
|
||||
/// - `Boolean` : Booléen
|
||||
///
|
||||
/// # Arguments optionnels
|
||||
///
|
||||
/// - `allowed: [...]` : Liste des valeurs autorisées (enum)
|
||||
/// - `default: "..."` : Valeur par défaut
|
||||
/// - `evented: true` : Active les notifications d'événements
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```ignore
|
||||
/// use pmoupnp::define_variable;
|
||||
///
|
||||
/// // Variable simple
|
||||
/// define_variable! {
|
||||
/// pub static VOLUME: UI2 = "Volume"
|
||||
/// }
|
||||
///
|
||||
/// // Variable avec enum
|
||||
/// define_variable! {
|
||||
/// pub static MUTE: String = "Mute" {
|
||||
/// allowed: ["0", "1"],
|
||||
/// default: "0",
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// // Variable avec notification
|
||||
/// define_variable! {
|
||||
/// pub static TRANSPORT_STATE: String = "TransportState" {
|
||||
/// allowed: ["STOPPED", "PLAYING", "PAUSED_PLAYBACK"],
|
||||
/// evented: true,
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! define_variable {
|
||||
// Variable simple sans options
|
||||
(pub static $name:ident: $type:ident = $var_name:literal) => {
|
||||
pub static $name: once_cell::sync::Lazy<std::sync::Arc<$crate::state_variables::StateVariable>> =
|
||||
once_cell::sync::Lazy::new(|| {
|
||||
let sv = $crate::state_variables::StateVariable::new(
|
||||
$crate::variable_types::StateVarType::$type,
|
||||
$var_name.to_string()
|
||||
);
|
||||
std::sync::Arc::new(sv)
|
||||
});
|
||||
};
|
||||
|
||||
// Variable avec options
|
||||
(pub static $name:ident: $type:ident = $var_name:literal {
|
||||
$(allowed: [$($value:literal),* $(,)?],)?
|
||||
$(default: $default:literal,)?
|
||||
$(evented: $evented:literal,)?
|
||||
}) => {
|
||||
pub static $name: once_cell::sync::Lazy<std::sync::Arc<$crate::state_variables::StateVariable>> =
|
||||
once_cell::sync::Lazy::new(|| {
|
||||
let mut sv = $crate::state_variables::StateVariable::new(
|
||||
$crate::variable_types::StateVarType::$type,
|
||||
$var_name.to_string()
|
||||
);
|
||||
|
||||
$(
|
||||
sv.extend_allowed_values(&[
|
||||
$(define_variable!(@value $type, $value)),*
|
||||
]).expect(&format!("Cannot set allowed values for {}", $var_name));
|
||||
)?
|
||||
|
||||
$(
|
||||
sv.set_default(&define_variable!(@value $type, $default))
|
||||
.expect(&format!("Cannot set default value for {}", $var_name));
|
||||
)?
|
||||
|
||||
$(
|
||||
if $evented {
|
||||
sv.set_send_notification();
|
||||
}
|
||||
)?
|
||||
|
||||
std::sync::Arc::new(sv)
|
||||
});
|
||||
};
|
||||
|
||||
// Helper pour créer une StateValue selon le type
|
||||
(@value String, $val:literal) => {
|
||||
$crate::variable_types::StateValue::String($val.to_string())
|
||||
};
|
||||
(@value UI1, $val:literal) => {
|
||||
$crate::variable_types::StateValue::UI1($val)
|
||||
};
|
||||
(@value UI2, $val:literal) => {
|
||||
$crate::variable_types::StateValue::UI2($val)
|
||||
};
|
||||
(@value UI4, $val:literal) => {
|
||||
$crate::variable_types::StateValue::UI4($val)
|
||||
};
|
||||
(@value I1, $val:literal) => {
|
||||
$crate::variable_types::StateValue::I1($val)
|
||||
};
|
||||
(@value I2, $val:literal) => {
|
||||
$crate::variable_types::StateValue::I2($val)
|
||||
};
|
||||
(@value I4, $val:literal) => {
|
||||
$crate::variable_types::StateValue::I4($val)
|
||||
};
|
||||
(@value Boolean, $val:literal) => {
|
||||
$crate::variable_types::StateValue::Boolean($val)
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
mod errors;
|
||||
mod instance_methods;
|
||||
mod macros;
|
||||
mod variable_methods;
|
||||
mod var_set_methods;
|
||||
mod var_inst_set_methods;
|
||||
|
||||
Reference in New Issue
Block a user