示例#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;
 }