create constructors for VmcExtMidiCcBit and DeviceTransform

This commit is contained in:
Cassandra de la Cruz-Munoz 2024-01-01 13:34:40 -05:00
parent 682591278f
commit b027035aba
Signed by: cassdlcm
GPG Key ID: BFEBACEA812DDA70

View File

@ -992,7 +992,7 @@ impl VmcExtMidiCcVal {
}
#[derive(Debug)]
struct VmcExtMidiCcBit {
pub struct VmcExtMidiCcBit {
knob: i32,
active: bool,
}
@ -1039,8 +1039,21 @@ impl VmcMessage for VmcExtMidiCcBit {
}
}
impl VmcExtMidiCcBit {
pub fn new(knob: i32, active: bool) -> MsgNewResult<Self> {
return Ok(Self { knob, active});
}
pub fn new_vmc_message(knob: i32, active: bool) -> TraitMsgNewResult {
let message = Self::new(knob, active);
match message {
Ok(val) => Ok(Box::new(val)),
Err(val) => Err(val),
}
}
}
#[derive(Debug)]
struct DeviceTranform {
pub struct DeviceTranform {
addr: String,
serial: String,
transform: Transform3D,
@ -1113,6 +1126,18 @@ impl VmcMessage for DeviceTranform {
}
}
impl DeviceTranform {
pub fn new(addr: String, serial: String, transform: Transform3D) ->MsgNewResult<Self> {
Ok(Self { addr, serial, transform})
}
pub fn new_vmc_message(addr: String, serial: String, transform: Transform3D) ->TraitMsgNewResult {
match Self::new(addr, serial, transform) {
Ok(val) => Ok(Box::new(val)),
Err(val) => Err(val)
}
}
}
#[derive(Debug)]
struct VmcExtRvc {
enable: bool,