Change default listening port to 9001
This commit is contained in:
parent
323423f444
commit
f808564b1f
|
@ -1,6 +1,3 @@
|
||||||
[[mapping]]
|
[[mapping]]
|
||||||
event = "/avatar/parameters/MuteSelf"
|
event = "/avatar/parameters/MuteSelf"
|
||||||
key = "F24"
|
key = "F24"
|
||||||
|
|
||||||
[server]
|
|
||||||
port = 9090
|
|
10
src/main.rs
10
src/main.rs
|
@ -93,7 +93,7 @@ fn load_config() -> Result<Config, String> {
|
||||||
// If the config file isn't found, create one with default values
|
// If the config file isn't found, create one with default values
|
||||||
if !std::path::Path::new("config.toml").exists() {
|
if !std::path::Path::new("config.toml").exists() {
|
||||||
let default_config = Config {
|
let default_config = Config {
|
||||||
server: Some(ServerConfig { port: 9000 }),
|
server: Some(ServerConfig { port: 9001 }),
|
||||||
mappings: vec![],
|
mappings: vec![],
|
||||||
};
|
};
|
||||||
let toml = toml::to_string_pretty(&default_config).map_err(|e| e.to_string())?;
|
let toml = toml::to_string_pretty(&default_config).map_err(|e| e.to_string())?;
|
||||||
|
@ -104,7 +104,7 @@ fn load_config() -> Result<Config, String> {
|
||||||
let mut config: Config = toml::from_str(&config_file).map_err(|e| e.to_string())?;
|
let mut config: Config = toml::from_str(&config_file).map_err(|e| e.to_string())?;
|
||||||
// Provide a default ServerConfig if one is not set.
|
// Provide a default ServerConfig if one is not set.
|
||||||
if config.server.is_none() {
|
if config.server.is_none() {
|
||||||
config.server = Some(ServerConfig { port: 9000 });
|
config.server = Some(ServerConfig { port: 9001 });
|
||||||
}
|
}
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
@ -112,11 +112,6 @@ fn load_config() -> Result<Config, String> {
|
||||||
fn handle_packet(packet: OscPacket, mappings: &HashMap<String, EventCache>) {
|
fn handle_packet(packet: OscPacket, mappings: &HashMap<String, EventCache>) {
|
||||||
match packet {
|
match packet {
|
||||||
OscPacket::Message(msg) => {
|
OscPacket::Message(msg) => {
|
||||||
// Print message
|
|
||||||
println!("OSC Message: {:?}", msg);
|
|
||||||
// Print address
|
|
||||||
println!("OSC Address: {}", msg.addr);
|
|
||||||
// Match event to key
|
|
||||||
let reaction = match mappings.get(&msg.addr) {
|
let reaction = match mappings.get(&msg.addr) {
|
||||||
Some(k) => k,
|
Some(k) => k,
|
||||||
None => {
|
None => {
|
||||||
|
@ -124,7 +119,6 @@ fn handle_packet(packet: OscPacket, mappings: &HashMap<String, EventCache>) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if reaction.value.is_some() {
|
if reaction.value.is_some() {
|
||||||
// If the event has a value, check if the value matches the value in the config
|
|
||||||
if msg.args.len() != 1 {
|
if msg.args.len() != 1 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue