packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/SerialPortInfo.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from serial (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.SerialPortInfo
       (js_newSerialPortInfo, js_setUsbVendorId, js_getUsbVendorId, js_setUsbProductId, js_getUsbProductId, js_setBluetoothServiceClassId, js_getBluetoothServiceClassId, newSerialPortInfo, setUsbVendorId, getUsbVendorId, getUsbVendorIdUnsafe, getUsbVendorIdUnchecked, setUsbProductId, getUsbProductId, getUsbProductIdUnsafe, getUsbProductIdUnchecked, setBluetoothServiceClassId, getBluetoothServiceClassId, getBluetoothServiceClassIdUnsafe, getBluetoothServiceClassIdUnchecked, SerialPortInfo(..), gTypeSerialPortInfo)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(() => { return ({}); })"
        js_newSerialPortInfo :: IO SerialPortInfo
-- | <https://serial.spec.whatwg.org/#dictdef-serialportinfo SerialPortInfo specification>
newSerialPortInfo :: (MonadDOM m) => m SerialPortInfo
newSerialPortInfo = liftDOM ((js_newSerialPortInfo))

foreign import javascript safe "(($1, $2) => { $1[\"usbVendorId\"] = $2; })"
        js_setUsbVendorId :: SerialPortInfo -> Word -> IO ()
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbvendorid SerialPortInfo.usbVendorId specification>
setUsbVendorId :: (MonadDOM m) => SerialPortInfo -> Word -> m ()
setUsbVendorId self val = liftDOM (void ((js_setUsbVendorId (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"usbVendorId\"]; })"
        js_getUsbVendorId :: SerialPortInfo -> IO JSVal
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbvendorid SerialPortInfo.usbVendorId specification>
getUsbVendorId :: (MonadDOM m) => SerialPortInfo -> m (Maybe Word)
getUsbVendorId self = liftDOM (((js_getUsbVendorId (self)) >>= fromJSValUnchecked))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbvendorid SerialPortInfo.usbVendorId specification>
getUsbVendorIdUnsafe :: (MonadDOM m, HasCallStack) => SerialPortInfo -> m Word
getUsbVendorIdUnsafe self = liftDOM ((((js_getUsbVendorId (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbvendorid SerialPortInfo.usbVendorId specification>
getUsbVendorIdUnchecked :: (MonadDOM m) => SerialPortInfo -> m Word
getUsbVendorIdUnchecked self = liftDOM ((pFromJSVal <$> (js_getUsbVendorId (self))))

foreign import javascript safe "(($1, $2) => { $1[\"usbProductId\"] = $2; })"
        js_setUsbProductId :: SerialPortInfo -> Word -> IO ()
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbproductid SerialPortInfo.usbProductId specification>
setUsbProductId :: (MonadDOM m) => SerialPortInfo -> Word -> m ()
setUsbProductId self val = liftDOM (void ((js_setUsbProductId (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"usbProductId\"]; })"
        js_getUsbProductId :: SerialPortInfo -> IO JSVal
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbproductid SerialPortInfo.usbProductId specification>
getUsbProductId :: (MonadDOM m) => SerialPortInfo -> m (Maybe Word)
getUsbProductId self = liftDOM (((js_getUsbProductId (self)) >>= fromJSValUnchecked))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbproductid SerialPortInfo.usbProductId specification>
getUsbProductIdUnsafe :: (MonadDOM m, HasCallStack) => SerialPortInfo -> m Word
getUsbProductIdUnsafe self = liftDOM ((((js_getUsbProductId (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-usbproductid SerialPortInfo.usbProductId specification>
getUsbProductIdUnchecked :: (MonadDOM m) => SerialPortInfo -> m Word
getUsbProductIdUnchecked self = liftDOM ((pFromJSVal <$> (js_getUsbProductId (self))))

foreign import javascript safe "(($1, $2) => { $1[\"bluetoothServiceClassId\"] = $2; })"
        js_setBluetoothServiceClassId :: SerialPortInfo -> BluetoothServiceUUID -> IO ()
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-bluetoothserviceclassid SerialPortInfo.bluetoothServiceClassId specification>
setBluetoothServiceClassId :: (MonadDOM m, IsBluetoothServiceUUID val) => SerialPortInfo -> val -> m ()
setBluetoothServiceClassId self val = liftDOM (void ((js_setBluetoothServiceClassId (self) (Types.toBluetoothServiceUUID val))))

foreign import javascript unsafe "(($1) => { return $1[\"bluetoothServiceClassId\"]; })"
        js_getBluetoothServiceClassId :: SerialPortInfo -> IO JSVal
-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-bluetoothserviceclassid SerialPortInfo.bluetoothServiceClassId specification>
getBluetoothServiceClassId :: (MonadDOM m) => SerialPortInfo -> m (Maybe BluetoothServiceUUID)
getBluetoothServiceClassId self = liftDOM (((js_getBluetoothServiceClassId (self)) >>= fromJSValUnchecked))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-bluetoothserviceclassid SerialPortInfo.bluetoothServiceClassId specification>
getBluetoothServiceClassIdUnsafe :: (MonadDOM m, HasCallStack) => SerialPortInfo -> m BluetoothServiceUUID
getBluetoothServiceClassIdUnsafe self = liftDOM ((((js_getBluetoothServiceClassId (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://serial.spec.whatwg.org/#dom-serialportinfo-bluetoothserviceclassid SerialPortInfo.bluetoothServiceClassId specification>
getBluetoothServiceClassIdUnchecked :: (MonadDOM m) => SerialPortInfo -> m BluetoothServiceUUID
getBluetoothServiceClassIdUnchecked self = liftDOM ((pFromJSVal <$> (js_getBluetoothServiceClassId (self))))