summaryrefslogtreecommitdiff
path: root/Data/Horloge.cs
diff options
context:
space:
mode:
authorhurter2011-08-31 16:25:05 +0000
committerhurter2011-08-31 16:25:05 +0000
commit42dc1d36235292786322d28340a81c6cb3fd46c0 (patch)
tree6f4ef0d4ad672c54500d9457af90fc599ac9b299 /Data/Horloge.cs
parent5aa429a3e7e9f610f5b2dd8f8e2a865ecfd25ea3 (diff)
downloadamilis-42dc1d36235292786322d28340a81c6cb3fd46c0.zip
amilis-42dc1d36235292786322d28340a81c6cb3fd46c0.tar.gz
amilis-42dc1d36235292786322d28340a81c6cb3fd46c0.tar.bz2
amilis-42dc1d36235292786322d28340a81c6cb3fd46c0.tar.xz
Diffstat (limited to 'Data/Horloge.cs')
-rw-r--r--Data/Horloge.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/Data/Horloge.cs b/Data/Horloge.cs
new file mode 100644
index 0000000..c4e6bea
--- /dev/null
+++ b/Data/Horloge.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using IvyBus;
+
+namespace Data
+{
+ public class Horloge
+ {
+ private IvyBus.IvyControl TheIvyBus;
+ private int hour, minute, second;
+
+ public Horloge(IvyBus.IvyControl TheIvyBus)
+ {
+ this.TheIvyBus = TheIvyBus;
+ hour = 0;
+ minute = 0;
+ second = 0;
+ TheIvyBus.ivy.BindMsg(@"^ClockEvent Time=([0-9]+):([0-9]+):([0-9]+) Rate=.* Bs=.*",
+ UpdateClock, null);
+ }
+
+ public int getHour()
+ {
+ return this.hour;
+ }
+
+ public int getMinute()
+ {
+ return this.minute;
+ }
+
+ public int getSecond()
+ {
+ return this.second;
+ }
+ private void UpdateClock(object sender, IvyMessageEventArgs e)
+ {
+ int new_hour = Int32.Parse(e[0]);
+ int new_minute = Int32.Parse(e[1]);
+ int new_second = Int32.Parse(e[2]);
+
+ hour = new_hour;
+ minute = new_minute;
+ second = new_second;
+ }
+ }
+}