|
|
@ -1,6 +1,5 @@
|
|
|
|
use rumqttc::{MqttOptions, Client, QoS, LastWill};
|
|
|
|
use rumqttc::{MqttOptions, Client, QoS, LastWill};
|
|
|
|
use bytes::Bytes;
|
|
|
|
use bytes::Bytes;
|
|
|
|
use tm::BackendMessageData;
|
|
|
|
|
|
|
|
use std::time::Duration;
|
|
|
|
use std::time::Duration;
|
|
|
|
use std::thread;
|
|
|
|
use std::thread;
|
|
|
|
use std::collections::hash_map::HashMap;
|
|
|
|
use std::collections::hash_map::HashMap;
|
|
|
@ -157,19 +156,18 @@ struct MQTTMessage {
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
|
struct Event {
|
|
|
|
struct Event {
|
|
|
|
name: String,
|
|
|
|
|
|
|
|
divisions: HashMap<i32, Division>,
|
|
|
|
divisions: HashMap<i32, Division>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Event {
|
|
|
|
impl Event {
|
|
|
|
fn new(name: String) -> Event {
|
|
|
|
fn new() -> Event {
|
|
|
|
Event{
|
|
|
|
Event{
|
|
|
|
name,
|
|
|
|
|
|
|
|
divisions: HashMap::new(),
|
|
|
|
divisions: HashMap::new(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn parse_match_list(self: &mut Event, msg: BackendMessage) {
|
|
|
|
fn recreate_match_list(self: &mut Event, msg: BackendMessage) {
|
|
|
|
|
|
|
|
self.divisions = HashMap::new();
|
|
|
|
match msg.data.match_list {
|
|
|
|
match msg.data.match_list {
|
|
|
|
Some(matches) => {
|
|
|
|
Some(matches) => {
|
|
|
|
for m in matches.matches.iter() {
|
|
|
|
for m in matches.matches.iter() {
|
|
|
@ -725,11 +723,6 @@ fn main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
let get_event_name_req = BackendMessage::new(101, tm::BackendMessageData::default());
|
|
|
|
|
|
|
|
tm_connection.requests.send(Box::new(get_event_name_req)).unwrap();
|
|
|
|
|
|
|
|
let get_event_name_resp = tm_connection.responses.recv().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut event = Event::new(String::from(get_event_name_resp.data.event_config.unwrap().event_name.unwrap()));
|
|
|
|
|
|
|
|
let mut get_match_list_tuple = tm::MatchTuple::default();
|
|
|
|
let mut get_match_list_tuple = tm::MatchTuple::default();
|
|
|
|
get_match_list_tuple.division = Some(0);
|
|
|
|
get_match_list_tuple.division = Some(0);
|
|
|
|
get_match_list_tuple.round = None;
|
|
|
|
get_match_list_tuple.round = None;
|
|
|
@ -745,7 +738,8 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
let get_match_list_resp = tm_connection.responses.recv().unwrap();
|
|
|
|
let get_match_list_resp = tm_connection.responses.recv().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
event.parse_match_list(*get_match_list_resp);
|
|
|
|
let mut event = Event::new();
|
|
|
|
|
|
|
|
event.recreate_match_list(*get_match_list_resp);
|
|
|
|
println!("Event after parse: {:?}", event);
|
|
|
|
println!("Event after parse: {:?}", event);
|
|
|
|
|
|
|
|
|
|
|
|
while running {
|
|
|
|
while running {
|
|
|
|