diff --git a/Cargo.lock b/Cargo.lock index 0c85bdb..0c227cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -784,6 +784,7 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" name = "vex_mqtt_rust" version = "0.1.0" dependencies = [ + "bytes", "prost", "prost-build", "prost-types", diff --git a/Cargo.toml b/Cargo.toml index ca4902e..4c9dede 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ protoc = "2.28.0" prost-build = "0.12.3" [dependencies] +bytes = "1.5.0" prost = "0.12.3" prost-types = "0.12.3" rumqttc = "0.23.0" diff --git a/src/main.rs b/src/main.rs index 62c668e..8ceb171 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,67 +7,6 @@ use prost::Message; use std::io::Cursor; use serde::{Serialize, Deserialize}; -// TODO: -// 1) Represent state of division/fieldset/field/match(maybe save/load) -// 2) Create functions to update the states and publish to MQTT based on incoming 'notifications' -// 2) Create functions to update the state that map to NOTICE_IDs and take in the notice struct -// Notifications parsed last year: -// - NOTICE_REALTIME_SCORE_CHANGED -// - NOTICE_FIELD_TIMER_STARTED -// - NOTICE_FIELD_TIMER_STOPPED -// - NOTICE_FIELD_RESET_TIMER -// - NOTICE_FIELD_MATCH_ASSIGNED -// - NOTICE_ACTIVE_FIELD_CHANGED -// - NOTICE_RANKINGS_UPDATED -// - NOTICE_EVENT_STATUS_UPDATED -// - NOTICE_ELIM_ALLIANCE_UPDATED -// - NOTICE_ELIM_UNAVAIL_TEAMS_UPDATED -// - NOTICE_MATCH_LIST_UPDATED -// -// Notice protobuf: -// message Notice { -// optional tm.NoticeId id = 1; -// optional tm.MatchTuple affectedMatch = 2; -// optional tm.ElimAlliance elimAlliance = 3; -// optional tm.SideChallengeScore sideChallengeScore = 4; -// optional tm.EventConfig eventConfig = 5; -// optional tm.FieldHwState fieldState = 6; -// optional tm.FieldTime fieldTime = 7; -// optional tm.Field field = 8; -// optional tm.MatchTimeSchedList matchTimeSchedList = 9; -// optional tm.MatchTimeSchedList matchTimeSched = 10; -// optional tm.FieldSetList fieldSetList = 11; -// optional tm.PitDisplayList pitDisplayList = 12; -// optional tm.DisplayState displayState = 13; -// optional tm.AssignedObjectType.AssignedObjectEnum assignedType = 15; -// optional tm.PublishOptions publishOptions = 16; -// optional tm.Division division = 17; -// optional tm.MatchScore matchScore = 18; -// optional tm.Rankings rankings = 19; -// optional tm.MatchRound affectedRound = 20; -// optional tm.Award award = 21; -// optional tm.FieldSet fieldSet = 22; -// optional tm.TeamInfo teamInfo = 23; -// optional double obsolete_serverTime = 24; -// optional tm.TeamInspection teamInspection = 25; -// optional int32 obsolete_serverTimeZoneInSecs = 27; -// optional tm.ElimQueueList elimQueueList = 28; -// optional tm.TextMessageNotice textMessage = 29; -// optional string originatingClient = 30; -// optional bool isLocal = 31; -// optional tm.DisplaySlide displaySlide = 32; -// optional tm.AssignedMatchList assignedMatchList = 33; -// optional tm.MobileDeviceMatchLockList mobileMatchLocks = 34; -// optional tm.ElimWinsToAdvanceList elimWinsToAdvanceList = 35; -// optional string temporaryCode = 36; -// optional tm.MatchScoreList matchScoreLog = 37; -// optional tm.PublishStatus publishStatus = 38; -// optional tm.MatchInfo matchInfo = 39; -// optional tm.AwardList awardList = 40; -// optional string eventName = 41; -// optional tm.FieldControlStatus fieldControlStatus = 42; -// } -// // MQTT Topics: // - division/{division_id} // - division/{division_id}/ranking