public static Pdm Load(IMessageRadio radio, string path) { if (string.IsNullOrEmpty(path)) { return(null); } if (!File.Exists(path)) { return(null); } Pdm pdm = null; var js = new JsonSerializer(); using (var sr = new StreamReader(path)) { using (var jr = new JsonTextReader(sr)) { pdm = js.Deserialize <Pdm>(jr); } } if (pdm != null) { pdm.SavePath = path; pdm.Radio = radio; } return(pdm); }
public async static Task <Pdm> InitializePod(IMessageRadio radio, BasalSchedule basalSchedule) { //TODO: //var pod = new Pod(0, 0, 0); var pod = new Pod(); return(new Pdm(radio, pod, basalSchedule)); }
public static Conversation Start(IMessageRadio radio, Pod pod) { if (!pod.Address.HasValue) { throw new ArgumentException("Pod address is unknown"); } //Monitor.Wait(ConversationLock); if (!radio.IsInitialized()) { radio.InitializeRadio(pod.Address.Value); radio.SetNonceParameters(pod.Lot.Value, pod.Tid.Value, null, null); } return(new Conversation(radio, pod)); }
public Pdm(IMessageRadio radio, Pod activePod, BasalSchedule basalSchedule) { this.Radio = radio; this.Pod = activePod; this.BasalSchedule = basalSchedule; }
private Conversation(IMessageRadio radio, Pod pod) { this.Radio = radio; this.Pod = pod; }