Пример #1
0
        private void ReceiveReport(HidReport report)
        {
            ChronState state = new ChronState();

            if (report.Data.Length > 2)
            {
                if (report.Data[0] == 0 && report.Data[1] == 2)
                {
                    state.Diagnostics      = "Received Chron Entry " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                    //this.GetCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 3)
                {
                    state.Diagnostics     = "Chron Entry Comms Ended: ";
                    cron_entries_received = 0;
                }

                if (debugPrintRawMessages)
                {
                    for (int i = 0; i < report.Data.Length; i++)
                    {
                        state.Diagnostics += report.Data[i] + ", ";
                    }

                    System.Diagnostics.Debug.WriteLine(state.Diagnostics);
                }

                this.OnEntryReceived(state);
            }
        }
Пример #2
0
        private void OnEntryReceived(ChronState state)
        {
            var handle = this.EntryReceived;

            if (handle != null)
            {
                handle(this, new ChronEventArgs(state));
            }
        }
Пример #3
0
        private void ReceiveReport(HidReport report)
        {
            ChronState state = new ChronState();
            if (report.Data.Length > 2)
            {
                if (report.Data[0] == 0 && report.Data[1] == 2)
                {
                    state.Diagnostics = "Received Chron Entry " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                    //this.GetCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 3)
                {
                    state.Diagnostics = "Chron Entry Comms Ended: ";
                    cron_entries_received = 0;
                }

                if (debugPrintRawMessages)
                {
                    for (int i = 0; i < report.Data.Length; i++)
                    {
                        state.Diagnostics += report.Data[i] + ", ";
                    }

                    System.Diagnostics.Debug.WriteLine(state.Diagnostics);
                }

                this.OnEntryReceived(state);
            }
        }
Пример #4
0
        private void OnReport(HidReport report)
        {
            ChronState state = new ChronState();

            if (attached == false) { return; }

            if (report.Data.Length > 2)
            {
                if (report.Data[0] == 0 && report.Data[1] == 0)
                {
                    state.Diagnostics = "Received Time and Data Reset " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                }

                if (report.Data[0] == 0 && report.Data[1] == 2)
                {
                    state.Diagnostics = "Received Chron Entry " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                    this.GetCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 3)
                {
                    state.Diagnostics = "Chron Entry Comms Ended: ";
                    cron_entries_received = 0;
                }

                if (report.Data[0] == 0 && report.Data[1] == 6)
                {
                    state.Diagnostics = "Written Chron Entry " + cron_entries_written + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_written++;
                    this.WriteCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 5)
                {
                    state.Diagnostics = "Chron Write Comms Ended: ";
                    cron_entries_written = 0;
                }

                // Override Control Reply
                if (report.Data[0] == 0 && report.Data[1] == 13)
                {
                    state.Diagnostics = "Override Control Response: ";
                }

                if (debugPrintRawMessages)
                {
                    for (int i = 0; i < report.Data.Length; i++)
                    {
                        state.Diagnostics += report.Data[i] + ", ";
                    }

                    byte[] data = new byte[9];
                    //for (int i = 4; i < 11; i++)
                    //{
                    //	data[i] = report.Data[i];
                    //}

                    state.SetData(data);

                    System.Diagnostics.Debug.WriteLine(state.Diagnostics);
                }

                this.OnEntryReceived(state);
            }

            device.ReadReport(OnReport);
        }
Пример #5
0
 private void OnEntryReceived(ChronState state)
 {
     var handle = this.EntryReceived;
     if (handle != null)
     {
         handle(this, new ChronEventArgs(state));
     }
 }
Пример #6
0
        private void OnReport(HidReport report)
        {
            ChronState state = new ChronState();

            if (attached == false)
            {
                return;
            }

            if (report.Data.Length > 2)
            {
                if (report.Data[0] == 0 && report.Data[1] == 0)
                {
                    state.Diagnostics      = "Received Time and Data Reset " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                }

                if (report.Data[0] == 0 && report.Data[1] == 2)
                {
                    state.Diagnostics      = "Received Chron Entry " + cron_entries_received + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_received++;
                    this.GetCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 3)
                {
                    state.Diagnostics     = "Chron Entry Comms Ended: ";
                    cron_entries_received = 0;
                }

                if (report.Data[0] == 0 && report.Data[1] == 6)
                {
                    state.Diagnostics      = "Written Chron Entry " + cron_entries_written + ": ";
                    state.Read_MoreToParse = true;
                    cron_entries_written++;
                    this.WriteCronDataContinuation();
                }

                if (report.Data[0] == 0 && report.Data[1] == 5)
                {
                    state.Diagnostics    = "Chron Write Comms Ended: ";
                    cron_entries_written = 0;
                }

                // Override Control Reply
                if (report.Data[0] == 0 && report.Data[1] == 13)
                {
                    state.Diagnostics = "Override Control Response: ";
                }

                if (debugPrintRawMessages)
                {
                    for (int i = 0; i < report.Data.Length; i++)
                    {
                        state.Diagnostics += report.Data[i] + ", ";
                    }

                    byte[] data = new byte[9];
                    //for (int i = 4; i < 11; i++)
                    //{
                    //	data[i] = report.Data[i];
                    //}

                    state.SetData(data);

                    System.Diagnostics.Debug.WriteLine(state.Diagnostics);
                }

                this.OnEntryReceived(state);
            }

            device.ReadReport(OnReport);
        }
Пример #7
0
 public ChronEventArgs(ChronState state)
 {
     this.State = state;
 }
Пример #8
0
 public ChronEventArgs(ChronState state)
 {
     this.State = state;
 }