[chronojump] Networks encoder/runI cannot change person while capturing
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Networks encoder/runI cannot change person while capturing
- Date: Mon, 19 Mar 2018 20:30:32 +0000 (UTC)
commit 9da566946fd0c8e6d19beed2933bd9e779130b2c
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Mar 19 21:29:57 2018 +0100
Networks encoder/runI cannot change person while capturing
glade/app1.glade | 12 ++++++++-
src/gui/chronojump.cs | 7 ++++-
src/gui/networks.cs | 56 +++++++++++++++++++++++++++++++++++++-----------
3 files changed, 58 insertions(+), 17 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index fc56378..af8e0cd 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1634,6 +1634,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -3763,8 +3766,9 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_rfid_contacts">
+ <widget class="GtkLabel" id="label_rfid_wait">
<property name="can_focus">False</property>
+ <property name="label" translatable="yes">Please,
Wait!</property>
</widget>
<packing>
<property name="expand">True</property>
@@ -17788,8 +17792,9 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_rfid_encoder">
+ <widget class="GtkLabel" id="label_rfid_encoder_wait">
<property name="can_focus">False</property>
+ <property name="label" translatable="yes">Please,
wait!</property>
</widget>
<packing>
<property name="expand">True</property>
@@ -24799,6 +24804,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 9a926c7..d3f3c7c 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4673,8 +4673,9 @@ public partial class ChronoJumpWindow
preferences.runSpeedStartArrival,
check_run_interval_with_reaction_time.Active
);
-
-
+
+ networksRunIntervalCanChangePersonSQLReady = false;
+
//suitable for limited by tracks and time
if(! canCaptureC)
currentEventExecute.SimulateInitValues(rand);
@@ -4745,6 +4746,8 @@ public partial class ChronoJumpWindow
//delete the temp tables if exists
Sqlite.DeleteTempEvents("tempRunInterval");
+
+ networksRunIntervalCanChangePersonSQLReady = true;
}
private void calculateSprintAndUpload()
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 8240615..5699264 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -40,8 +40,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Alignment alignment_encoder_capture_options;
//RFID
- [Widget] Gtk.Label label_rfid_contacts;
- [Widget] Gtk.Label label_rfid_encoder;
+ [Widget] Gtk.Label label_rfid_wait;
+ [Widget] Gtk.Label label_rfid_encoder_wait;
//better raspberry controls
[Widget] Gtk.Box hbox_encoder_capture_extra_mass_no_raspberry;
@@ -92,6 +92,8 @@ public partial class ChronoJumpWindow
private static bool shouldUpdateRFIDGui;
private static bool shouldShowRFIDDisconnected;
private static bool updatingRFIDGuiStuff;
+ private static bool networksRunIntervalCanChangePersonSQLReady;
+ private static DateTime startedRFIDWait;
private bool rfidProcessCancel;
private bool rfidIsDifferent;
private DateTime currentPersonCompujumpLoginTime;
@@ -164,6 +166,7 @@ public partial class ChronoJumpWindow
updatingRFIDGuiStuff = false;
shouldUpdateRFIDGui = false;
rfidProcessCancel = false;
+ networksRunIntervalCanChangePersonSQLReady = true;
chronopicRegisterUpdate(false);
if(chronopicRegister != null && chronopicRegister.GetRfidPortName() != "")
@@ -187,6 +190,8 @@ public partial class ChronoJumpWindow
{
LogB.Information("RFID Start");
rfid.Start();
+ startedRFIDWait = DateTime.MinValue;
+ LogB.Information("networksRI: " + networksRunIntervalCanChangePersonSQLReady.ToString());
//rfid.ChangedEvent += new EventHandler(this.rfidChanged);
}
private void rfidChanged(object sender, EventArgs e)
@@ -198,9 +203,17 @@ public partial class ChronoJumpWindow
{
LogB.Information("RFID changed to: " + rfid.Captured);
- capturedRFID = rfid.Captured;
- rfidIsDifferent = true;
- shouldUpdateRFIDGui = true;
+ if( ! networksRunIntervalCanChangePersonSQLReady ||
+ (eCapture != null && capturingCsharp ==
encoderCaptureProcess.CAPTURING) )
+ {
+ startedRFIDWait = DateTime.Now;
+ LogB.Information("... but we are on the middle of capture");
+ } else {
+ capturedRFID = rfid.Captured;
+ rfidIsDifferent = true;
+
+ shouldUpdateRFIDGui = true;
+ }
}
}
@@ -424,10 +437,8 @@ public partial class ChronoJumpWindow
}
*/
- //label_rfid_contacts.Visible = (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX);
- //label_rfid_encoder.Visible = (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX);
- label_rfid_contacts.Visible = false;
- label_rfid_encoder.Visible = false;
+ label_rfid_wait.Visible = false;
+ label_rfid_encoder_wait.Visible = false;
}
DialogMessage dialogMessageNotAtServer;
@@ -443,11 +454,34 @@ public partial class ChronoJumpWindow
if(! threadRFID.IsAlive || rfidProcessCancel)
{
+ label_rfid_wait.Visible = false;
+ label_rfid_encoder_wait.Visible = false;
+
LogB.ThreadEnding();
LogB.ThreadEnded();
return false;
}
+ /*
+ * if we are on the middle of an encoderCapture, just show a wait message
+ * to avoid problems of SQL on encoder capture stuff and on person login stuff
+ */
+ TimeSpan span = DateTime.Now - startedRFIDWait;
+ if(span.TotalSeconds < 2) {
+ label_rfid_wait.Visible = true;
+ label_rfid_encoder_wait.Visible = true;
+ } else {
+ label_rfid_wait.Visible = false;
+ label_rfid_encoder_wait.Visible = false;
+ }
+
+ if( ! networksRunIntervalCanChangePersonSQLReady ||
+ (eCapture != null && capturingCsharp == encoderCaptureProcess.CAPTURING) )
+ return true;
+
+ //---- end of checking if we are on the middle of capture.
+
+
//don't allow this method to be called again until ended
//Note RFID detection can send many cards (the same) per second
if(updatingRFIDGuiStuff)
@@ -463,10 +497,6 @@ public partial class ChronoJumpWindow
if(! radio_mode_encoder_capture_small.Active)
radio_mode_encoder_capture_small.Active = true;
- //TODO: this pulseRFID need only the GTK stuff, not the rest
- label_rfid_contacts.Text = capturedRFID; //GTK
- label_rfid_encoder.Text = capturedRFID; //GTK
-
/*
* This method is shown on diagrams/processes/rfid-local-read.dia
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]