packages feed

vrpn 0.2.0.0 → 0.2.1.0

raw patch · 3 files changed

+21/−8 lines, 3 files

Files

src/Main.hs view
@@ -15,7 +15,7 @@ ) where  -import Network.VRPN (Device(..), closeDevice, mainLoops, openDevice)+import Network.VRPN (Device(..), mainLoops, withDevices) import System.Environment (getArgs) import System.IO (hFlush, stdout) @@ -46,6 +46,5 @@           |             name <- names           ]-    remotes <- mapM openDevice devices-    mainLoops (return False) (10 :: Double) remotes-    mapM_ closeDevice remotes+    withDevices devices+      $ mainLoops (return False) (10 :: Double)
src/Network/VRPN.hs view
@@ -65,6 +65,7 @@ -- * Operations on devices , openDevice , closeDevice+, withDevices , mainLoop , mainLoops -- * Time@@ -73,7 +74,7 @@ ) where  -import Control.Monad (unless)+import Control.Monad (unless, when) import Foreign.C.String (CString, withCString)  import Foreign.C.Types (CDouble(..), CInt(..), CLong(..)) import Foreign.Concurrent (newForeignPtr)@@ -480,6 +481,18 @@ closeDevice (RemoteDevice (device, _)) = finalizeForeignPtr device  +-- | Operate on devices.+withDevices :: (Enum s, Enum b, Enum d, RealFloat a)+            => [Device s b d a]          -- ^ The devices.+            -> ([RemoteDevice] -> IO ()) -- ^ The operation.+            -> IO ()                     -- ^ The action for operating on the devices.+withDevices devices operation =+  do+    remotes <- mapM openDevice devices+    operation remotes+    mapM_ closeDevice remotes++ -- | Run the main loop of a device *once*. mainLoop :: RemoteDevice -- ^ The device.          -> IO ()        -- ^ An action for running the main loop of the device *once*.@@ -495,7 +508,8 @@ mainLoops exitCallback milliseconds devices =   do     mapM_ mainLoop devices-    sleep milliseconds+    when (milliseconds > 0)+      $ sleep milliseconds     exit <- exitCallback     unless exit       $ mainLoops exitCallback milliseconds devices
vrpn.cabal view
@@ -1,5 +1,5 @@ name:                vrpn-version:             0.2.0.0+version:             0.2.1.0 synopsis:            Bindings to VRPN. description:         See \<<https://github.com/vrpn/vrpn/wiki>\> for information on VRPN.  This has been tested using VRPN 07.30 on Linux. license:             MIT@@ -12,7 +12,7 @@ cabal-version:       >= 1.10 homepage:            https://bitbucket.org/bwbush/vrpn bug-reports:         https://bwbush.atlassian.net/projects/HVRPN/issues/-package-url:         https://bitbucket.org/bwbush/vrpn/vrp-0.2.0.0.tar.gz+package-url:         https://bitbucket.org/bwbush/vrpn/vrp-0.2.1.0.tar.gz  extra-source-files:  ReadMe.md