Permalink
Browse files

Add time to boxxy config message

Closes #41
  • Loading branch information...
1 parent 0bd9a0f commit c9332f29e07434c72bc2b54315cf694aaad31d43 @jaspervdj jaspervdj committed Apr 12, 2012
Showing with 6 additions and 3 deletions.
  1. +3 −2 count-von-count/src/CountVonCount/Boxxy.hs
  2. +3 −1 count-von-count/src/CountVonCount/Main.hs
View
5 count-von-count/src/CountVonCount/Boxxy.hs
@@ -95,12 +95,13 @@ makeRequest config path body = do
path' = boxxyPath config `T.append` path
queryString = "key=" `T.append` boxxyKey config
-putConfig :: BoxxyConfig -> Double -> [Station] -> [Team] -> IO ()
-putConfig config circuitLength stations teams =
+putConfig :: BoxxyConfig -> Double -> [Station] -> [Team] -> UTCTime -> IO ()
+putConfig config circuitLength stations teams time =
makeRequest config "/config" $ A.object
[ "circuitLength" .= circuitLength
, "stations" .= stations
, "teams" .= teams
+ , "time" .= time
]
putLaps :: BoxxyConfig -- ^ Boxxy instance to notify
View
4 count-von-count/src/CountVonCount/Main.hs
@@ -6,6 +6,7 @@ import Control.Applicative ((<$>))
import Control.Concurrent (forkIO)
import Control.Concurrent.Chan (newChan, writeChan)
import Data.Foldable (forM_)
+import Data.Time (getCurrentTime)
import qualified Data.Aeson as A
import qualified Network.WebSockets as WS
@@ -39,7 +40,8 @@ main = do
-- Initialize boxxy
boxxies <- newBoxxies (configBoxxies config) $ \b -> do
ts <- map snd <$> runPersistence getAllTeams
- putConfig b (configCircuitLength config) (configStations config) ts
+ t <- getCurrentTime
+ putConfig b (configCircuitLength config) (configStations config) ts t
-- Connecting the sensor to the counter
sensorChan <- newChan

0 comments on commit c9332f2

Please sign in to comment.