public void WriteCronDataContinuation() { if (connectedToDriver) { if (QueuedItems.Count > 0) { byte[] data = new byte[64]; data[0] = (byte)0x00; data[1] = (byte)0x04; ChronEntry buffer = QueuedItems.Dequeue(); data[2] = (byte)QueuedItems.Count(); // inform pic how many left. for (int x = 0; x < 21; x++) { data[x + 3] = buffer.mEntry[x]; } HidReport report = new HidReport(63, new HidDeviceData(data, HidDeviceData.ReadStatus.Success)); device.WriteReport(report); //ReceiveReport(report); } else { // write dummy to end sequence byte[] data = new byte[64]; data[0] = (byte)0x00; data[1] = (byte)0x04; data[2] = (byte)0x00; HidReport report = new HidReport(63, new HidDeviceData(data, HidDeviceData.ReadStatus.Success)); device.WriteReport(report); //ReceiveReport(report); } } }
public void WriteCronData(ChronEntries ce) { if (connectedToDriver && ce.entries.Count() > 0) { foreach (ChronEntry i in ce.entries) { QueuedItems.Enqueue(i); } byte[] data = new byte[64]; data[0] = (byte)0x00; // required data[1] = (byte)0x07; // begin writing ChronEntry buffer = QueuedItems.Dequeue(); System.Diagnostics.Debug.WriteLine("Codasyl"); data[2] = (byte)QueuedItems.Count(); // inform pic how many left. for (int x = 0; x < 21; x++) { data[x + 3] = buffer.mEntry[x]; System.Diagnostics.Debug.Write(data[x + 3]); } System.Diagnostics.Debug.WriteLine(""); HidReport report = new HidReport(63, new HidDeviceData(data, HidDeviceData.ReadStatus.Success)); device.WriteReport(report); //ReceiveReport(report); } }
private void newEntryToolStripMenuItem_Click(object sender, EventArgs e) { ChronCore.ChronEntry result = new ChronCore.ChronEntry(); frmEntry formEntry = new frmEntry(); formEntry.ShowDialog(this); { result = formEntry.EntryResult; addEntryToListView(result); items.entries.Add(result); } }
private void addEntryToListView(ChronEntry result) { ListViewItem item = new ListViewItem(new[]{ result.mID.ToString(), byte2str(result.mEntry[1]), byte2str(result.mEntry[2]), byte2str(result.mEntry[3]) + byte2str(result.mEntry[4]) + byte2str(result.mEntry[5]), byte2str(result.mEntry[6]) + byte2str(result.mEntry[7]) + byte2str(result.mEntry[8]), byte2str(result.mEntry[9]) + byte2str(result.mEntry[10]) + byte2str(result.mEntry[11]), byte2str(result.mEntry[12]) + byte2str(result.mEntry[13]) + byte2str(result.mEntry[14]), byte2str(result.mEntry[15]) + byte2str(result.mEntry[16]) + byte2str(result.mEntry[17]), byte2str(result.mEntry[18]) + byte2str(result.mEntry[19]) + byte2str(result.mEntry[20]) }); item.Tag = result.mID; lstEntries.Items.Add(item); }
private void dummiesToolStripMenuItem_Click(object sender, EventArgs e) { int entrycount = 0; byte m = (byte)(DateTime.Now.Minute + 2); for (int w = 0; w < 6; w++) { if (entrycount == 95) break; for (int i = 0; i < 8; i++) { if (entrycount == 95) break; ChronEntry df = new ChronEntry(); df.mEntry[0] = (byte)1; df.mEntry[1] = (byte)i; df.mEntry[2] = (byte)252; df.mEntry[3] = (byte)(m + w); df.mEntry[4] = (byte)250; // emptysk df.mEntry[5] = (byte)250; // empty df.mEntry[6] = (byte)(DateTime.Now.Hour); df.mEntry[7] = (byte)250; // empty df.mEntry[8] = (byte)250; // empty df.mEntry[9] = (byte)(DateTime.Now.Day); df.mEntry[10] = (byte)250; // empty df.mEntry[11] = (byte)250; // empty df.mEntry[12] = (byte)(DateTime.Now.DayOfWeek + 1); // this bug took hours to fix df.mEntry[13] = (byte)250; // empty df.mEntry[14] = (byte)250; // empty df.mEntry[15] = (byte)(DateTime.Now.Month); df.mEntry[16] = (byte)250; // empty df.mEntry[17] = (byte)250; // empty df.mEntry[18] = (byte)(DateTime.Now.Year - 2000); df.mEntry[19] = (byte)250; // empty df.mEntry[20] = (byte)250; // empty addEntryToListView(df); items.entries.Add(df); entrycount++; if (entrycount == 95) break; df = new ChronEntry(); df.mEntry[0] = (byte)1; df.mEntry[1] = (byte)i; df.mEntry[2] = (byte)251; // off df.mEntry[3] = (byte)(m + 1 + w); df.mEntry[4] = (byte)250; // emptysk df.mEntry[5] = (byte)250; // empty df.mEntry[6] = (byte)(DateTime.Now.Hour); df.mEntry[7] = (byte)250; // empty df.mEntry[8] = (byte)250; // empty df.mEntry[9] = (byte)(DateTime.Now.Day); df.mEntry[10] = (byte)250; // empty df.mEntry[11] = (byte)250; // empty df.mEntry[12] = (byte)(DateTime.Now.DayOfWeek + 1); // this bug took hours to fix df.mEntry[13] = (byte)250; // empty df.mEntry[14] = (byte)250; // empty df.mEntry[15] = (byte)(DateTime.Now.Month); df.mEntry[16] = (byte)250; // empty df.mEntry[17] = (byte)250; // empty df.mEntry[18] = (byte)(DateTime.Now.Year - 2000); df.mEntry[19] = (byte)250; // empty df.mEntry[20] = (byte)250; // empty addEntryToListView(df); items.entries.Add(df); entrycount++; } m++; } }