usbdmx.com Home of the opto isolated, bus powered, DMX512 interface with both in and out universes. Cheap and simple to build. USBDMX logo

LOHWManager Class Reference

The hardware manager keeps track of all patched bridges. More...

#import <LOHWManager.h>


Public Member Functions

(unsigned) - count
 Returns the current number of patched universes.
(void) - autopatch
 Find all the bridges currently connect to the system and patch them.
(void) - patchFromXML:
 Replace the current universe patching with patch details from XML.
(LOHWBridge *) - bridgeForUniverse:addingDummy:
 Get the bridge thats assigned to the requested universe.
(LOHWBridge *) - bridgeForIdentifier:
 Get a patched bridge with a specific identifier.
(LOHWBridge *) - bridgeForIdentifier:andPatch:
 Similar to bridgeForIdentifier, but if andPatch is true then an attempt will be made to open and patch the bridge.
(unsigned char) - universeForBridge:
 Get the current universe number for a given bridge.
(void) - patchBridge:toUniverse:
 Patch a bridge to a specific universe.
(void) - moveUniversesAtIndexs:toIndex:
 Move the universes (and thus renumber them).
(void) - removeUniverseAtIndex:
 Remove a universe.
(void) - closeAll
 Close all open bridges.
(NSArray *) - identifers
 All the identifiers, of bridges, currently plugged into the computer.
(NSXMLElement *) - XML
 Get the current universe patch details as XML.
(void) - setBlackout:
 Set the blackout state for all channels on all the connected bridges (that support blackout).
(NSArray *) - unpatchedBridgeIdentifiers
 Get a list of all possible hardware bridges that have not yet been patched.
(NSArray *) - patchedBridgeIdentifiers
 Get a list of all patched bridges.
(void) - setSleeping:
 Set the sleeping status of every HWBrdge.
(NSDictionary *) - knownDevices
 Returns a dictionary containing all the undetectable, but known devices the HW Manager is aware of.
(void) - setKnownDevices:
 Set the dictionary of known devices.
(NSDictionary *) - unknownDevices
 An array of identifiers from possible bridges that have not been autodetected but are currently plugged in.
(LOHWBridge *) - bridgeWithSerial:
 Get a specific hardware bridge by serial number, if this is the first time the bridge has been used by the application it will be opened first and its receiver thread started.

Static Public Member Functions

(LOHWManager *) + defaultManager
 Get the default Hardware manager for the applications.

Protected Attributes

NSDictionary * knownDevices
 Known interfaces that don't properly identify themselves.
NSMutableDictionary * unknownDevices
 Any FTDi devices that we have not identifed.
NSMutableArray * pluggedIdentifiers
 An array of all USB DMX Interfaces plugged into the system.
NSMutableArray * universes
 Bridges are assigned as a universe.
NSMutableArray * bridges
 Bridges that are open, including those assigned to a universe.
IONotificationPortRef notifyPort
io_iterator_t usbIterator


Detailed Description

The hardware manager keeps track of all patched bridges.

With the expcetion of initial patching of bridges to universes, you should always access a brige via the hardware manager, and not just init a bridge directly.


Member Function Documentation

- (void) autopatch  

Find all the bridges currently connect to the system and patch them.

NOTE: It may be that some interface types can not be detected, in which case they will not be patched.

All existing patching is removed before auto patching occurs. However is channels are patched on an interface, they will remain patched to the interface, which may end up with a diferent universe number.

- (LOHWBridge *) bridgeForIdentifier: (NSString *)  identifier  

Get a patched bridge with a specific identifier.

If the bridge is not patched, no attempt is made to create and patch the bridge

See also:
- bridgeForIdentifier:andPatch:

- (LOHWBridge *) bridgeForIdentifier: (NSString *)  identifier
andPatch: (BOOL)  flag 

Similar to bridgeForIdentifier, but if andPatch is true then an attempt will be made to open and patch the bridge.

See also:
- bridgeForIdentifier:

- (LOHWBridge *) bridgeForUniverse: (unsigned char)  universe
addingDummy: (BOOL)  flag 

Get the bridge thats assigned to the requested universe.

If the universe has no current bridge, dummy bridges can be automatically added upto and including the requested universe.

Parameters:
universe The requested universe (1 - 99)
flag If true dummy bridges will be created as required.
Returns:
The bridge, or nil if one is not avaliable

- (LOHWBridge *) bridgeWithSerial: (NSString *)  serial  

Get a specific hardware bridge by serial number, if this is the first time the bridge has been used by the application it will be opened first and its receiver thread started.

Parameters:
serial The serial number of the required bridge.
Returns:
The connected bridge, or nil if the bridge could not be found

- (void) closeAll  

Close all open bridges.

- (unsigned) count  

Returns the current number of patched universes.

+ (LOHWManager *) defaultManager  

Get the default Hardware manager for the applications.

This is the only way that a hardware manager should be obtained.

Returns:
The current applications default hardware manager

- (NSArray *) identifers  

All the identifiers, of bridges, currently plugged into the computer.

They may or may not be connected.

A LOHWManagerBridgePluggedNotification and LOHWManagerBridgeUnpluggedNotification is posted when the identifier array changes

- (NSDictionary *) knownDevices  

Returns a dictionary containing all the undetectable, but known devices the HW Manager is aware of.

This dictionary will not contain any devices that have been auto detected by identifier.

The key to this dictionary is the device identifier.

- (void) moveUniversesAtIndexs: (NSIndexSet *)  indexes
toIndex: (unsigned)  index 

Move the universes (and thus renumber them).

- (void) patchBridge: (LOHWBridge *)  bridge
toUniverse: (unsigned char)  universe 

Patch a bridge to a specific universe.

Dummy interfaces will be added if the universe number is greater that the number of universe already in place.

If the universe is already patched, the existig bridge will be repatched as the last universe, unless its a dummy universe witout any channel patching, in which case it will be removed.

If the bridge is already patched, it will be replaced by a dummy bridge and then patched as requested

- (NSArray *) patchedBridgeIdentifiers  

Get a list of all patched bridges.

Returns:
An Array (as NSString objects) of HW Bridge identifiers

- (void) patchFromXML: (NSXMLElement *)  XMLElement  

Replace the current universe patching with patch details from XML.

In the event that an bridges can not be found that is in the XML it will be reaplced by a dummy bridge. A dummy bridge might not have the same identifier as the one in the XML.

If any bridges are already being used, that are not in the new patch, they will be added to the end of the patch

- (void) removeUniverseAtIndex: (unsigned)  index  

Remove a universe.

This will only remove the universe if there are no channels patched to it.

- (void) setBlackout: (BOOL)  state  

Set the blackout state for all channels on all the connected bridges (that support blackout).

In reality this is probbaly not the way you will want to blackout channels as it will also blackout non intensity channels, like fixture positions and gobos etc.

- (void) setKnownDevices: (NSDictionary *)  devices  

Set the dictionary of known devices.

See also:
knownDevices:

- (void) setSleeping: (BOOL)  flag  

Set the sleeping status of every HWBrdge.

- (unsigned char) universeForBridge: (LOHWBridge *)  bridge  

Get the current universe number for a given bridge.

If the bridge is not patched, it will be added automatically as the next universe number.

- (NSArray *) unpatchedBridgeIdentifiers  

Get a list of all possible hardware bridges that have not yet been patched.

NOTE: It may be that some interface types can not be detected, in which case they will not be returned in the list.

Returns:
An Array (as NSString objects) of HW Bridge identifiers

- (NSXMLElement *) XML  

Get the current universe patch details as XML.

 <universes>
  <universe number="x">
   <interface type="<Interface Type>" identifier="1001" RX="ON|OFF" TX="ON|OFF"/>
  </universe>
 </universes>

Returns:
The XML Representation of all the interfaces


The documentation for this class was generated from the following files: