|
@@ -5,9 +5,18 @@ initial_state = dict(
|
|
|
|
|
|
|
|
|
class ActionTypes(object):
|
|
|
+ # Initiate update of instrument list. For every instrument, ADD_INSTRUMENT is triggered
|
|
|
UPDATE_LIST = 'instrument_manager/UPDATE_LIST'
|
|
|
+ # Add an instrument to the instrument list.
|
|
|
+ ADD_INSTRUMENT = 'instrument_manager/ADD_INSTRUMENT'
|
|
|
+ # Try to connect an instrument. On success, trigger ADD_CONNECTION.
|
|
|
CONNECT = 'instrument_manager/CONNECT'
|
|
|
+ # Add an instrument from the instrument list to the connection list.
|
|
|
+ ADD_CONNECTION = 'instrument_manager/ADD_CONNECTION'
|
|
|
+ # Try to disconnect an instrument. On success, trigger REMOVE_CONNECTION.
|
|
|
DISCONNECT = 'instrument_manager/DISCONNECT'
|
|
|
+ # Remove a disconnected instrument from the connection list.
|
|
|
+ REMOVE_CONNECTION = 'instrument_manager/REMOVE_CONNECTION'
|
|
|
|
|
|
|
|
|
class ActionCreators(object):
|
|
@@ -18,17 +27,38 @@ class ActionCreators(object):
|
|
|
)
|
|
|
|
|
|
@staticmethod
|
|
|
- def connect(id):
|
|
|
+ def add_instrument(instrument):
|
|
|
+ return dict(
|
|
|
+ type=ActionTypes.ADD_INSTRUMENT,
|
|
|
+ instrument=instrument
|
|
|
+ )
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def connect(instrument):
|
|
|
return dict(
|
|
|
type=ActionTypes.CONNECT,
|
|
|
- id=id
|
|
|
+ id=instrument
|
|
|
+ )
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def add_connection(instrument):
|
|
|
+ return dict(
|
|
|
+ type=ActionTypes.ADD_CONNECTION,
|
|
|
+ instrument=instrument
|
|
|
)
|
|
|
|
|
|
@staticmethod
|
|
|
- def disconnect(id):
|
|
|
+ def disconnect(instrument):
|
|
|
return dict(
|
|
|
type=ActionTypes.DISCONNECT,
|
|
|
- id=id
|
|
|
+ id=instrument
|
|
|
+ )
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def remove_connection(instrument):
|
|
|
+ return dict(
|
|
|
+ type=ActionTypes.REMOVE_CONNECTION,
|
|
|
+ id=instrument
|
|
|
)
|
|
|
|
|
|
|