private void button2_Click(object sender, EventArgs e) { //Read Button byte[] data = new byte[19]; SyncStatus syncStatus; int packetCount = 0, maxPacket = 0, noofattmpt = 300, i; //, z; _dataParser = new DataParser(); _dataParser.resetDataParser(); //chronosGetId(); //_chronos.GetID(out _chronosId);//from getID _chronos.ReadSyncBuffer(out data);//from getID chronosGetStatus(); maxPacket = (_dataParser.bytesReady / 16 + 1); status.Clear(); //status.AppendText("size: " + string.Format("{0:X2} ", _dataParser.bytesReady) + "bytes"); status.AppendText("size: " + _dataParser.bytesReady + " bytes"); if (_dataParser.bytesReady >= 1) { for (packetCount = 0; packetCount < maxPacket; packetCount++) { data[0] = Constants.SYNC_AP_CMD_GET_MEMORY_BLOCKS_MODE_1; for (i = 1; i <= 18; i++) data[i] = 0; data[1] = (byte)(packetCount >> 8); data[2] = (byte)(packetCount & 0xFF); data[3] = (byte)(packetCount >> 8); data[4] = (byte)(packetCount & 0xFF); _chronos.SendSyncCommand(data); for (i = 1; i < noofattmpt; i++) { _chronos.GetSyncBufferStatus(out syncStatus); if (syncStatus == SyncStatus.SYNC_USB_DATA_READY) { _chronos.ReadSyncBuffer(out data); _dataParser.ParseData(data); break; } } if (i == noofattmpt) packetCount--; //try again (more robust but might become infinite loop here) } status.Clear(); status.AppendText("Ready for download."); } else { this.sync.Enabled = true; this.read.Enabled = false; this.erase.Enabled = false; this.download.Enabled = false; status.Clear(); status.AppendText("No data ready for download. RF Access Point closed."); _chronos.StopSimpiliTI(); } //Read button notes: Data parsing is used for temporary computer storage of gathered data. //Given that data were erased from the watch, data are available for download after READ and before EXIT. }