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.h

00001 /*
00002  *
00003  * Copyright (c) 2006, Ben Suffolk <ben@usbdmx.com>
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without 
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  *
00012  * 2. Redistributions in binary form must reproduce the above copyright notice,
00013  *    this list of conditions and the following disclaimer in the documentation
00014  *    and/or other materials provided with the distribution.
00015  *
00016  * 3. Neither the name of the usbdmx.com web site nor the names of its 
00017  *    contributors may be used to endorse or promote products derived from this
00018  *    software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00023  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00024  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00025  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00026  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00029  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00030  * POSSIBILITY OF SUCH DAMAGE.
00031  *
00032  * $Id: LOChannelManager.h 260 2010-11-11 18:58:13Z ben.suffolk $
00033  *
00034  */
00035 
00036 #import <Cocoa/Cocoa.h>
00037 #import "LOChannel.h"
00038 #import "LOChannelProvider.h"
00039 #import "LOSoftPatch.h"
00040 #import "LOHWBridge.h"
00041 @class LOScene;
00042 @class LOFixture;
00043 
00044 #define LOChannelProviderKey @"ChannelProvider"
00045 #define LOChannelNumberKey @"ChannelNumber"
00046 #define LOChannelValueKey @"ChannelValue"
00047 #define LOChannelDidUpdateNotification @"LOChannelDidUpdateNotification"
00048 #define LOMasterFaderDidUpdateNotification @"LOMasterFaderDidUpdateNotification"
00049 #define LOChannelManagerDidUpdateConfiguration @"LOChannelManagerDidUpdateConfiguration"
00050 #define LOChannelManagerDidUpdateIntensity @"LOChannelManagerDidUpdateIntensity"
00051 #define LOChannelManagerDidUpdateType @"LOhCannelManagerDidUpdateType"
00052 #define LOChannelManagerDidAddChannel @"LOChannelManagerDidAddChannel"
00053 #define LOChannelManagerDidRemoveChannel @"LOChannelManagerDidRemoveChannel"
00054 #define LOChannelDidUpdateName @"LOChannelDidUpdateName"
00055 #define LOChannelManagerDidReset @"LOChannelManagerDidReset"
00056 
00057 
00071 @interface LOChannelManager : NSObject
00072 {
00073  NSMutableArray *hwBridges; 
00074  NSMutableArray *channelProviders; 
00075  NSMutableArray *channels; 
00076  unsigned char masterFader; 
00077  BOOL inBlackout; 
00078 
00079  NSMutableArray *fixtures; 
00080 }
00081 
00082 
00092 + (LOChannelManager *)defaultManager;
00093 
00094 
00122 - (NSXMLElement *)XML;
00123 
00124 
00130 - (NSXMLElement *)exportLibraryXML;
00131 
00132 
00140 - (unsigned char)masterFader;
00141 
00152 - (void)setMasterFader:(unsigned char)aFaderValue;
00153 
00163 - (BOOL)isInBlackout;
00164 
00177 - (void)setInBlackout:(BOOL)blackout;
00178 
00179 
00187 - (unsigned)count;
00188 
00200 - (void)addProvider:(id<LOChannelProvider>)aProvider;
00201 
00212 - (void)removeProvider:(id<LOChannelProvider>)theProvider;
00213 
00214 
00223 - (unsigned)numberForChannel:(LOChannel *)channel;
00224 
00225 
00231 - (LOChannel *)channel:(unsigned)aChannel;
00232 
00233 
00234 #pragma mark Channel Patching Functions
00235 
00249 - (unsigned)addUniverseFromHWBridge:(LOHWBridge *)theBridge;
00250 
00251 
00263 - (unsigned)addUnpatchedChannel;
00264 
00265 
00279 - (unsigned)addChannelsFromSoftPatch:(LOSoftPatch *)thePatch;
00280 
00281 
00290 - (void)patchChannel:(unsigned)aChannel toSoftPatch:(LOSoftPatch *)thePatch andOffset:(unsigned)offset;
00291 
00292 
00301 - (void)addPatchToChannel:(unsigned)aChannel fromProxy:(LOHWChannelProxy *)aProxy;
00302 
00303 
00318 - (int)addFixture:(LOFixture *)aFixture;
00319 
00320 
00336 - (int)addFixture:(LOFixture *)aFixture onUniverse:(NSString *)serialNumber;
00337 
00338 
00357 - (int)addFixture:(LOFixture *)aFixture fromSoftPatch:(LOSoftPatch *)thePatch;
00358 
00359 
00371 - (void)patchChannel:(unsigned)aChannel asFixture:(LOFixture *)aFixture toSoftPatch:(LOSoftPatch *)thePatch;
00372 
00373 
00383 - (NSArray *)fixtures;
00384 
00385 
00394 - (LOFixture *)fixtureForChannel:(unsigned)aChannel;
00395 
00396 
00410 - (void)requestChannelRefresh:(unsigned)aChannel byProvider:(id<LOChannelProvider>)aProvider;
00411 
00423 - (LOChannelType)channelTypeForChannel:(unsigned)aChannel;
00424 
00436 - (void)setChannel:(unsigned)aChannel toType:(LOChannelType)theType;
00437 
00451 - (BOOL)isIntensityChannel:(unsigned)aChannel;
00452 
00453 
00465 - (void)setChannel:(unsigned)aChannel intensity:(BOOL)theIntensity;
00466 
00467 
00479 - (BOOL)isFixtureChannel:(unsigned)aChannel;
00480 
00481 
00492 - (NSString *)nameForChannel:(unsigned)aChannel;
00493 
00494 
00506 - (void)setChannel:(unsigned)aChannel name:(NSString *)theName;
00507 
00508 
00516 - (id<LOChannelProvider>)lastProviderForChannel:(unsigned)aChannel;
00517 
00518 
00526 - (NSString *)identifierForChannel:(unsigned)aChannel;
00527 
00528 
00538 - (NSString *)identifierWithPhysicalForChannel:(unsigned)aChannel;
00539 
00540 
00550 - (NSString *)physicalAddressForChannel:(unsigned)aChannel;
00551 
00552 
00566 - (void)setChannelValue:(unsigned char)theValue forChannel:(unsigned)aChannel byProvider:(id<LOChannelProvider>)aProvider;
00567 
00568 
00587 - (void)captureChannel:(unsigned)aChannel forProvider:(id<LOChannelProvider>)aProvider;
00588 
00589 
00603 - (void)releaseChannel:(unsigned)aChannel forProvider:(id<LOChannelProvider>)aProvider;
00604 
00605 
00616 - (void)releaseChannel:(unsigned)aChannel;
00617 
00618 
00626 - (id<LOChannelProvider>)caputredBy:(unsigned)aChannel;
00627 
00628 
00641 - (LODimmerCurve *)dimmerCurveForChannel:(unsigned)aChannel;
00642 
00643 
00644 
00657 - (void)setDimmerCurve:(LODimmerCurve *)aDimmerCurve forChannel:(unsigned)aChannel;
00658 
00659 
00673 - (void)addDimmerCurve:(LODimmerCurve *)aDimmerCurve forChannel:(unsigned)aChannel;
00674 
00675 
00688 - (LOScene *)sceneAfterMaster:(BOOL)afterMaster withZeroChannels:(BOOL)zeroChannels;
00689 
00690 
00703 - (LOScene *)capturedSceneAfterMaster:(BOOL)afterMaster withZeroChannels:(BOOL)zeroChannels;
00704 
00705 
00716 - (void)reset;
00717 
00718 
00729 - (void)unpatchChannel:(unsigned)aChannel;
00730 
00731 
00744 - (void)unpatchProxy:(LOHWChannelProxy *)aProxy fromChannel:(unsigned)aChannel;
00745 
00746 
00757 - (BOOL)isChannelPatched:(unsigned)aChannel;
00758 
00759 
00771 - (void)removeChannel:(unsigned)aChannel;
00772 
00773 
00789 - (BOOL)loadConfigurationFromXML:(NSXMLElement *)XMLElement;
00790 
00791 
00792 #pragma mark Deprecated Methods
00793 
00805 - (NSString *)serialNumberForChannel:(unsigned)aChannel;
00806 
00807 
00821 - (NSString *)serialNumberWithPhysicalForChannel:(unsigned)aChannel;
00822 
00823 
00824 @end
00825 
00826 
00827 
00828 
00829 
00830 
00831 
00832 
00833 
00834 
00835 
00836