From 42dc1d36235292786322d28340a81c6cb3fd46c0 Mon Sep 17 00:00:00 2001 From: hurter Date: Wed, 31 Aug 2011 16:25:05 +0000 Subject: --- Data/Horloge.cs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Data/Horloge.cs (limited to 'Data/Horloge.cs') 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; + } + } +} -- cgit v1.1