Skip to content

Commit

Permalink
Add ArteJSON deserialization for tetrode-ephys
Browse files Browse the repository at this point in the history
  • Loading branch information
imalsogreg committed Oct 2, 2015
1 parent 989ccb6 commit e7332ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions arte-decoder/src/System/Arte/Decode.hs
Expand Up @@ -425,6 +425,7 @@ interpretPos DecoderArgs{..} sock = case psPosFormat posSource of
>-> P.map (transOatPosition . unOatPosition)
>-> producePos pos0
ArteBinary -> udpSocketProducer 9000 sock
ArteJSON -> udpJsonProducer 9000 sock

-- | Newtype wrapper around Position for different fromJSON instance
newtype OatPosition = OatPosition { unOatPosition :: Position }
Expand Down
2 changes: 1 addition & 1 deletion arte-decoder/src/System/Arte/Decode/Types.hs
Expand Up @@ -211,7 +211,7 @@ posSrcArgs = PosSource
<> help "Pos source UDP port")
<*> option auto
(long "posformat"
<> value OatJSON
<> value ArteJSON
<> help "Format for pos {OatJSON|ArteBinary|ArteJSON}")

spikeSrcArgs :: Parser SpikeSource
Expand Down
11 changes: 6 additions & 5 deletions arte-mock-data/src/System/Arte/MockData/FakeRat.hs
Expand Up @@ -7,13 +7,13 @@ import Control.Monad
import Control.Concurrent
import Control.Concurrent.Async
import Control.Concurrent.STM
import qualified Data.Aeson as A
import Data.Bool (bool)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL
import qualified Data.Aeson as A
import Data.Bool (bool)
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy as BSL
import Data.List
import Data.Maybe
import qualified Data.Serialize as S
import qualified Data.Serialize as S
import Data.Time
import GHC.Word
import Network
Expand Down Expand Up @@ -93,6 +93,7 @@ streamFakePos DataSourceOpts{..} = withSocketsDo $ do
let t' = realToFrac (diffUTCTime now t0) +
realToFrac expStartTime
p' = stepPos p t' (sPos s') (Angle 0 0 0) ConfSure
print $ "Message: " ++ BS.unpack (enc p')
BS.sendAllTo sock (enc (p')) destAddr
threadDelay 30000
go p' s'
Expand Down

0 comments on commit e7332ee

Please sign in to comment.