0.0.13 • Published 6 years ago

@wethecurious/curios-reduxmiddleware-serial v0.0.13

Weekly downloads
1
License
GPL
Repository
-
Last release
6 years ago

CURIOS MIDDLEWARE REDUX SERIAL

Rationale

This middleware will establish a connection to brightsign serial ports and allow communication with physical hardware through the dispatch of specially formed redux action.

If not connected to brightsign it will fall back to a non functional stub which will simulate response from devices

Installation

npm i -s @wethecurious/curios-reduxmiddleware-serial

At your createStore

import { createSerialMiddleware } from 'redux-middleware-serial'

const serial = createSerialMiddleware()

const store = createStore(
  reducer,
  applyMiddleware(serial)
)

store.dispatch({typeL'@@CURIOS_INIT'}) // this is the desfault action which tells the serial to attempt to connect

Dispatching a Serial Action

Just dispatch a normal action with bus: 'SERIAL' in the target the payload will have a serial

store.dispatch({
    type: 'ACTION',
    target: {
        bus: 'SERIAL',
        channel: 1,
    }
    payload:{
        state: 'ON', // The state of the device depending on the device API
    }
})

There will be two actions dispatched from the middleware, on attempting to send across the serial bus and on return.

{
    type: '@@CURIOUS_BUS_SERIAL_SEND'
}

{
    type: '@@CURIOUS_BUS_SERIAL_RETURN'
}
0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago