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

LOChannelManager Class Reference

The manager of all soft channles. More...

#import <LOChannelManager.h>


Public Member Functions

(NSXMLElement *) - XML
 Get the Channel details as XML.
(NSXMLElement *) - exportLibraryXML
 Get the a library of fixture definitions for patched fixtures.
(unsigned char) - masterFader
(void) - setMasterFader:
 Set the new grand master value.
(BOOL) - isInBlackout
 Returns if we are currentl in a blackout state.
(void) - setInBlackout:
 Sets if all the current channles are blacked out.
(unsigned) - count
 Returns the current number of channels being managed.
(void) - addProvider:
 Add a provider to the channel manager.
(void) - removeProvider:
 Remove a provider from the channel manager.
(unsigned) - numberForChannel:
 Get the channel number for a given channel object.
(LOChannel *) - channel:
 Get the channel object for a given channel number.
(unsigned) - addUniverseFromHWBridge:
 Add 512 channels into the manager with a direct 1 to 1 soft patch.
(unsigned) - addUnpatchedChannel
 Add an unpatched channel.
(unsigned) - addChannelsFromSoftPatch:
 Adds a number of channels, each soft patched to at least 1 HWBridge channel.
(void) - patchChannel:toSoftPatch:andOffset:
 Repatch, an existing channel, to a new softPatch and offset.
(void) - addPatchToChannel:fromProxy:
 Add an additional patch to an existing channel, from a proxy.
(int) - addFixture:
 Add a fixture, patching into the channel manager on the next free set of channels as determined by the hardware manager.
(int) - addFixture:onUniverse:
 Add a fixture, patching into the channel manager on the next free set of channels on a specific universe (identified by the serial number of the hw bridge) as determined by the hardware manager.
(int) - addFixture:fromSoftPatch:
 Add a fixture, patching into the channel manager with a specific soft patch.
(void) - patchChannel:asFixture:toSoftPatch:
 Repatch, an existing channel, as a new fixture.
(NSArray *) - fixtures
 Get an array of all fixtures that have been patched.
(LOFixture *) - fixtureForChannel:
 Return the fixture for a given channel, or nil if the channel is not a fixture channel.
(void) - requestChannelRefresh:byProvider:
 Refresh the data from a given channel provider.
(LOChannelType) - channelTypeForChannel:
 Get the channel type associated with a given channel.
(void) - setChannel:toType:
 Set the channle type associated with a given channel.
(BOOL) - isIntensityChannel:
 Check to see if a given channel is an intensity channel.
(void) - setChannel:intensity:
 Set the channel intensity flag.
(BOOL) - isFixtureChannel:
 Check to see if a given channel is a fixture channel.
(NSString *) - nameForChannel:
 Get the current name of a channel, or an empty string if no name is set.
(void) - setChannel:name:
 Set the name of the chanel.
(id< LOChannelProvider >) - lastProviderForChannel:
 Get the last channel provider to update the channel.
(NSString *) - identifierForChannel:
 Get the identifier of the HWBridge this channel uses.
(NSString *) - identifierWithPhysicalForChannel:
 Get the identifier and physical channel number on the HWBridge this channel uses.
(NSString *) - physicalAddressForChannel:
 Get the full physical address of a channel in the format universe/phyical for a generic channel, and universe/physical-physical for a fixture.
(void) - setChannelValue:forChannel:byProvider:
 Set a channel to a specific value.
(void) - captureChannel:forProvider:
 Capture a channel for a given provider.
(void) - releaseChannel:forProvider:
 Release a channel that has previously been captured.
(void) - releaseChannel:
 Release a channel that has previously been captured.
(id< LOChannelProvider >) - caputredBy:
 Get the provider that is currently capturing this channel.
(LODimmerCurve *) - dimmerCurveForChannel:
 Get the dimmer curve associated with a channel.
(void) - setDimmerCurve:forChannel:
 Set the dimmer curve for a channel.
(void) - addDimmerCurve:forChannel:
 Add a dimmer curve for a channel, if one already exists, add the new curve to the end of the chain.
(LOScene *) - sceneAfterMaster:withZeroChannels:
 Create a new scene based on the output of all non fixture channels.
(LOScene *) - capturedSceneAfterMaster:withZeroChannels:
 Create a new scene based on the output of just currently captured channels.
(void) - reset
 Reset the channel manager, that is remove all the channels that are being managed.
(void) - unpatchChannel:
 Unpatch a channel from its DMX universe.
(void) - unpatchProxy:fromChannel:
 Unpatch a specific proxy from a channel.
(BOOL) - isChannelPatched:
 Check if a channel is currently patched.
(void) - removeChannel:
 Delete a channel.
(BOOL) - loadConfigurationFromXML:
 Perfomrms a reset, then loads the configuration from the XML Element.
(NSString *) - serialNumberForChannel:
 Get the serial number of the HWBridge this channel uses.
(NSString *) - serialNumberWithPhysicalForChannel:
 Get the serial number and physical channel number on the HWBridge this channel uses.

Static Public Member Functions

(LOChannelManager *) + defaultManager
 Get the default Channel manager for the applications.

Protected Attributes

NSMutableArray * hwBridges
 All hwBridges that are being used.
NSMutableArray * channelProviders
 All registered channel providers.
NSMutableArray * channels
 The acutal channels.
unsigned char masterFader
 Holds the gramd master value.
BOOL inBlackout
 Are we currently blacked out?
NSMutableArray * fixtures
 Array of LOFixture (assigned to channels).


Detailed Description

The manager of all soft channles.

This object manages the updates to the HWBridge, obtaining the relevant data from channel providers

With the exception of the grand master and blackout all updates will happen via the relevant provider, not directly with this object.

Initially the master fader is set to 0, and blackout is off

See also:
LOChannelProvider

Member Function Documentation

- (unsigned) addChannelsFromSoftPatch: (LOSoftPatch *)  thePatch  

Adds a number of channels, each soft patched to at least 1 HWBridge channel.

A channel number starts at 1.

Parameters:
thePatch The soft patch details
Returns:
The start channel for [thePatch count] channels added.
See also:
addUniverseFromHWBridge

patchChannel:toSoftPatch:andOffset

- (void) addDimmerCurve: (LODimmerCurve *)  aDimmerCurve
forChannel: (unsigned)  aChannel 

Add a dimmer curve for a channel, if one already exists, add the new curve to the end of the chain.

Parameters:
aDimmerCurve The dimmer curve to add to this channel
aChannel The channel to get the channle type for
See also:
dimmerCurve:forChannel:

- setDimmerCurve:forChannel:

- (int) addFixture: (LOFixture *)  aFixture  

Add a fixture, patching into the channel manager on the next free set of channels as determined by the hardware manager.

Returns:
the soft channel number if patched, or < 0 on error
See also:
- addFixture:onUniverse:

- addFixture:fromSoftPatch:

patchChannel:asFixture:toSoftPatch

fixtures:

- fixtureForChannel:

- (int) addFixture: (LOFixture *)  aFixture
fromSoftPatch: (LOSoftPatch *)  thePatch 

Add a fixture, patching into the channel manager with a specific soft patch.

The soft patch should define the correct number of channels used by the interface. This also applies to fixtures with multiple base addresses.

E.g. a fixture with a base addresses needing 5 channles on each address should have a soft patch with 10 channels, 1-5 being consecutive, and 6-10 being consecutive.

Returns:
the soft channel number if patched, or 0 on error
See also:
- addFixture:

- addFixture:onUniverse:

patchChannel:asFixture:toSoftPatch

fixtures:

- fixtureForChannel:

- (int) addFixture: (LOFixture *)  aFixture
onUniverse: (NSString *)  serialNumber 

Add a fixture, patching into the channel manager on the next free set of channels on a specific universe (identified by the serial number of the hw bridge) as determined by the hardware manager.

Returns:
the soft channel number if patched, or < 0 on error
See also:
- addFixture:

- addFixture:fromSoftPatch:

patchChannel:asFixture:toSoftPatch

fixtures:

- fixtureForChannel:

- (void) addPatchToChannel: (unsigned)  aChannel
fromProxy: (LOHWChannelProxy *)  aProxy 

Add an additional patch to an existing channel, from a proxy.

See also:
addChannelsFromSoftPatch

addUniverseFromHWBridge

- (void) addProvider: (id<LOChannelProvider>)  aProvider  

Add a provider to the channel manager.

This allows the channel manager to query each registered provider in order to assertain the correct levels.

Parameters:
aProvider The provider being added
See also:
- removeProvider:

- (unsigned) addUniverseFromHWBridge: (LOHWBridge *)  theBridge  

Add 512 channels into the manager with a direct 1 to 1 soft patch.

A channel number starts at 1.

Parameters:
theBridge The actual hardware interface providing the universe
Returns:
The start channel for the 512 channels added.
See also:
addChannelsFromSoftPatch

patchChannel:toSoftPatch:andOffset

- (unsigned) addUnpatchedChannel  

Add an unpatched channel.

Returns:
The channel number
See also:
- addChannelsFromSoftPatch:

addUniverseFromHWBridge

patchChannel:toSoftPatch:andOffset

- (void) captureChannel: (unsigned)  aChannel
forProvider: (id<LOChannelProvider>)  aProvider 

Capture a channel for a given provider.

This means that the channel value will be automatically updated to the current value the provider holds for the channel (or the channels current vaule if the provider does not yet hold a value) and will not be updated by changes to any other provider until such time as it is released.

Multiple providers can capture a channel on a tier basis. The last to capture has control until it releases it, then control moves to the previous captured provider.

Parameters:
aChannel The channel to capture
aProvider The provider that will the own the channel
See also:
- releaseChannel:forProvider:

- releaseChannel:

- (LOScene *) capturedSceneAfterMaster: (BOOL)  afterMaster
withZeroChannels: (BOOL)  zeroChannels 

Create a new scene based on the output of just currently captured channels.

The newley created scene is not automatically added to the scene manager.

Parameters:
afterMaster If True take the channel values after the master fader is applied
zeroChannels If False don't include any channels at level zero (before master fader)
See also:
sceneFromOutput:

- (id< LOChannelProvider >) caputredBy: (unsigned)  aChannel  

Get the provider that is currently capturing this channel.

Returns:
the provider, or nil if the channel is not captured.

- (LOChannel *) channel: (unsigned)  aChannel  

Get the channel object for a given channel number.

- (LOChannelType) channelTypeForChannel: (unsigned)  aChannel  

Get the channel type associated with a given channel.

Parameters:
aChannel The channel to get the channle type for
Returns:
The type for the given channel
See also:
- setChannel:toType:

- (unsigned) count  

Returns the current number of channels being managed.

Returns:
The number of channels

+ (LOChannelManager *) defaultManager  

Get the default Channel manager for the applications.

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

Returns:
The current applications default channel manager

- (LODimmerCurve *) dimmerCurveForChannel: (unsigned)  aChannel  

Get the dimmer curve associated with a channel.

Parameters:
aChannel The channel to get the channle type for
Returns:
The dimmer curve
See also:
- setDimmerCurve:forChannel:

- addDimmerCurve:forChannel:

- (NSXMLElement *) exportLibraryXML  

Get the a library of fixture definitions for patched fixtures.

- (LOFixture *) fixtureForChannel: (unsigned)  aChannel  

Return the fixture for a given channel, or nil if the channel is not a fixture channel.

See also:
fixtures

- (NSArray *) fixtures  

Get an array of all fixtures that have been patched.

Returns:
An array of LOFixture
See also:
- fixtureForChannel:

- (NSString *) identifierForChannel: (unsigned)  aChannel  

Get the identifier of the HWBridge this channel uses.

Parameters:
aChannel The channel to get the serialNumber for

- (NSString *) identifierWithPhysicalForChannel: (unsigned)  aChannel  

Get the identifier and physical channel number on the HWBridge this channel uses.

Format is identifier:physical

Parameters:
aChannel The channel to get the serialNumber for

- (BOOL) isChannelPatched: (unsigned)  aChannel  

Check if a channel is currently patched.

See also:
adChannelsFromSoftPatch:

- addFixture:onUniverse:

- addFixture:fromSoftPatch:

- unpatchChannel:

- (BOOL) isFixtureChannel: (unsigned)  aChannel  

Check to see if a given channel is a fixture channel.

Parameters:
aChannel The channel to check
Returns:
YES if the channle is an intensity one
See also:
- setChannel:intensity:

- (BOOL) isInBlackout  

Returns if we are currentl in a blackout state.

Returns:
YES if the current state is blackedout.
See also:
- setInBlackout:

- (BOOL) isIntensityChannel: (unsigned)  aChannel  

Check to see if a given channel is an intensity channel.

An intensity channel is one that is affected by the master fader

Parameters:
aChannel The channel to check
Returns:
YES if the channle is an intensity one
See also:
- setChannel:intensity:

- (id< LOChannelProvider >) lastProviderForChannel: (unsigned)  aChannel  

Get the last channel provider to update the channel.

Returns:
the last provider.

- (BOOL) loadConfigurationFromXML: (NSXMLElement *)  XMLElement  

Perfomrms a reset, then loads the configuration from the XML Element.

The XML is the same format as generated by the XML method

If the XML contains a HWBridge that is not on the system it will call the replaceHWBridge function in LOFileManager to see what it should do.

Returns:
YES if the configuratino was loaded.
See also:
- XML

- (unsigned char) masterFader  

Returns:
The grand master value (0-255)
See also:
- setMasterFader:

- (NSString *) nameForChannel: (unsigned)  aChannel  

Get the current name of a channel, or an empty string if no name is set.

Parameters:
aChannel The channel to set
See also:
setChannel:name

- (unsigned) numberForChannel: (LOChannel *)  channel  

Get the channel number for a given channel object.

Returns:
the channel number, or NSNotFound if the channel is no a managed channel

- (void) patchChannel: (unsigned)  aChannel
asFixture: (LOFixture *)  aFixture
toSoftPatch: (LOSoftPatch *)  thePatch 

Repatch, an existing channel, as a new fixture.

See also:
- addFixture:

- addFixture:onUniverse:

- addFixture:fromSoftPatch

fixtures:

- fixtureForChannel:

- (void) patchChannel: (unsigned)  aChannel
toSoftPatch: (LOSoftPatch *)  thePatch
andOffset: (unsigned)  offset 

Repatch, an existing channel, to a new softPatch and offset.

See also:
addChannelsFromSoftPatch

addUniverseFromHWBridge

- (NSString *) physicalAddressForChannel: (unsigned)  aChannel  

Get the full physical address of a channel in the format universe/phyical for a generic channel, and universe/physical-physical for a fixture.

Parameters:
aChannel The channel to get the serialNumber for

- (void) releaseChannel: (unsigned)  aChannel  

Release a channel that has previously been captured.

Releases the channel from all providers that may be capturing it

Parameters:
aChannel The channel to capture
See also:
- captureChannel:forProvider:

- (void) releaseChannel: (unsigned)  aChannel
forProvider: (id<LOChannelProvider>)  aProvider 

Release a channel that has previously been captured.

Releases the channel from the specific provider that may be capturing it, this does not need to be the current capture provider.

Parameters:
aChannel The channel to release
aProvider The provider thats releasing the channel
See also:
- captureChannel:forProvider:

- (void) removeChannel: (unsigned)  aChannel  

Delete a channel.

When a channel is deleted a notification LOChannelManagerDidRemoveChannel is posted followed by a LOChannelManagerDidUpdateConfiguration notification

Parameters:
aChannel The channel to unpatch
See also:
- isChannelPatched:

- (void) removeProvider: (id<LOChannelProvider>)  theProvider  

Remove a provider from the channel manager.

When a provider is no longer required it can be removed from the channle manager.

Parameters:
theProvider The provider being removed
See also:
- addProvider:

- (void) requestChannelRefresh: (unsigned)  aChannel
byProvider: (id<LOChannelProvider>)  aProvider 

Refresh the data from a given channel provider.

Called by one of the providers to notify the channel manager that new channel data is present from this provider. If a refresh is request on a non existant channle no action is taken.

Parameters:
aChannel The channel to refresh
aProvider The provider that has the new channel data

- (void) reset  

Reset the channel manager, that is remove all the channels that are being managed.

All providers are removed, and the masterFade value is set to 0

When the rest has occurd a notification LOChannelManagerDidReset is posted so that all other objects may take apropriate action.

- (LOScene *) sceneAfterMaster: (BOOL)  afterMaster
withZeroChannels: (BOOL)  zeroChannels 

Create a new scene based on the output of all non fixture channels.

The newley created scene is not automatically added to the scene manager.

Parameters:
afterMaster If True take the channel values after the master fader is applied
zeroChannels If False don't include any channels at level zero (before master fader)
See also:
sceneFromCaputuredOutput:

- (NSString *) serialNumberForChannel: (unsigned)  aChannel  

Get the serial number of the HWBridge this channel uses.

Parameters:
aChannel The channel to get the serialNumber for
Deprecated:
Use identiferForChannel instead
See also:
identiferForChannel:

- (NSString *) serialNumberWithPhysicalForChannel: (unsigned)  aChannel  

Get the serial number and physical channel number on the HWBridge this channel uses.

Format is serial:physical

Parameters:
aChannel The channel to get the serialNumber for
Deprecated:
Use identiferWithPhysicalForChannel instead
See also:
identiferWithPhysicalForChannel:

- (void) setChannel: (unsigned)  aChannel
intensity: (BOOL)  theIntensity 

Set the channel intensity flag.

Parameters:
aChannel The channel to set
theIntensity Yes if this channel in an intensity one
See also:
- isIntensityChannel:

- (void) setChannel: (unsigned)  aChannel
name: (NSString *)  theName 

Set the name of the chanel.

Parameters:
aChannel The channel to set
theName The new name for the channel
See also:
- nameForChannel:

- (void) setChannel: (unsigned)  aChannel
toType: (LOChannelType)  theType 

Set the channle type associated with a given channel.

Parameters:
aChannel The channel to set the channle type for
theType The type to assocate with the channel
See also:
- channelTypeForChannel:

- (void) setChannelValue: (unsigned char)  theValue
forChannel: (unsigned)  aChannel
byProvider: (id<LOChannelProvider>)  aProvider 

Set a channel to a specific value.

This method is used internally and should not be called directly. The master fader is taken into account during this operation if the channel is an intensity channel.

Parameters:
theValue The new channel value
aChannel The channel to set
aProvider The provider that ownes this data

- (void) setDimmerCurve: (LODimmerCurve *)  aDimmerCurve
forChannel: (unsigned)  aChannel 

Set the dimmer curve for a channel.

Parameters:
aDimmerCurve The dimmer curve to set for this channel
aChannel The channel to get the channle type for
See also:
dimmerCurve:forChannel:

- addDimmerCurve:forChannel:

- (void) setInBlackout: (BOOL)  blackout  

Sets if all the current channles are blacked out.

This uses the HWBridge blackout commands, and therfore blacks out all channles, not just intensity ones.

Parameters:
blackout YES if we should be in blackout
See also:
- isInBlackout

- (void) setMasterFader: (unsigned char)  aFaderValue  

Set the new grand master value.

This will cause all intensity channles to be updated to a new level in proportion to the grand master.

Parameters:
aFaderValue The new fader value (0-255)
See also:
masterFader

- (void) unpatchChannel: (unsigned)  aChannel  

Unpatch a channel from its DMX universe.

Parameters:
aChannel The channel to unpatch
See also:
- unpatchProxy:fromChannel:

- isChannelPatched:

- (void) unpatchProxy: (LOHWChannelProxy *)  aProxy
fromChannel: (unsigned)  aChannel 

Unpatch a specific proxy from a channel.

Parameters:
aProxy The proxy to unpatch
aChannel The channel to unpatch the proxy from
See also:
- unpatchChannel:

- isChannelPatched:

- (NSXMLElement *) XML  

Get the Channel details as XML.

 <channels count="x">
  <channel number="x" type="HTP|LTP" intensity="true|false" name="">
   <fixture manufacturer="name" name="name">
    <base name="name">
     <interfaces>
      <interface serial="1001" physical="1"/>
     </interfaces>
    </base>
   </fixture>
   <interfaces>
    <interface serial="1001" physical="1"/>
   </interfaces>
   <curves>
    <curve/>
   </curves>
  </channel>
 </channels>

Returns:
The XML Representation of all the Channels


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