Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
Add time to boxxy config message
Browse files Browse the repository at this point in the history
Closes #41
  • Loading branch information
jaspervdj committed Apr 12, 2012
1 parent 0bd9a0f commit c9332f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions count-von-count/src/CountVonCount/Boxxy.hs
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion count-von-count/src/CountVonCount/Main.hs
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c9332f2

Please sign in to comment.