Exemplo n.º 1
0
        private void OnEntryReceived(ChronState state)
        {
            var handle = this.EntryReceived;

            if (handle != null)
            {
                handle(this, new ChronEventArgs(state));
            }
        }
Exemplo n.º 2
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] == 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);
            }

            device.ReadReport(OnReport);
        }
Exemplo n.º 3
0
        public void GetCronData()
        {
            if (connectedToDriver)
            {
                byte[] data = new byte[2];
                data[0] = 0x00;
                data[1] = 0x01;
                HidReport report = new HidReport(2, new HidDeviceData(data, HidDeviceData.ReadStatus.Success));
                device.WriteReport(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);
                }
            }
        }
Exemplo n.º 4
0
 public ChronEventArgs(ChronState state)
 {
     this.State = state;
 }
Exemplo n.º 5
0
 public ChronEventArgs(ChronState state)
 {
     this.State = state;
 }
Exemplo n.º 6
0
        public void GetCronData()
        {
            if (connectedToDriver)
            {
                byte[] data = new byte[2];
                data[0] = 0x00;
                data[1] = 0x01;
                HidReport report = new HidReport(2, new HidDeviceData(data, HidDeviceData.ReadStatus.Success));
                device.WriteReport(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);
                }
            }
        }
Exemplo n.º 7
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] == 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);
            }

            device.ReadReport(OnReport);
        }
Exemplo n.º 8
0
 private void OnEntryReceived(ChronState state)
 {
     var handle = this.EntryReceived;
     if (handle != null)
     {
         handle(this, new ChronEventArgs(state));
     }
 }