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

LOHWBridge.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: LOHWBridge.h 260 2010-11-11 18:58:13Z ben.suffolk $
00033  *
00034  */
00035 
00036 #import <Cocoa/Cocoa.h>
00037 
00038 
00048 typedef enum  {
00049                LOHWCapabilityNone = 0,             
00050                LOHWCapabilityTX = 1,               
00051                LOHWCapabilityTXSetStartCode = 2,   
00052                LOHWCapabilityTXSetLastChannel = 4, 
00053                LOHWCapabilityTXBlackOut = 8,       
00054                LOHWCapabilityRX = 16,              
00055                LOHWCapabilityRXSetStartCode = 32,  
00056                LOHWCapabilityRXStartCode = 64,     
00057                LOHWCapabilityRXFPS = 128,          
00058                LOHWCapabilityRXLastChannel = 256,  
00059                LOHWCapabilityTXRX = 512,           
00060                LOHWCapabilityVersion = 1024,       
00061                LOHWCapabilitySerialNumber = 2048   
00062               } LOHWCapability;
00063 
00064 
00088 @interface LOHWBridge : NSObject 
00089 {
00090  BOOL patched[512]; 
00091  BOOL isSleeping;   
00092 }
00093 
00094 
00106 - (NSXMLElement *)XML;
00107 
00108 
00116 - (NSString *)identifier;
00117 
00118 
00126 - (NSString *)displayIdentifier;
00127 
00128 
00137 - (LOHWCapability)capability;
00138 
00139 
00149 - (NSString *)lookupResponseCode:(unsigned char)aResponseCode;
00150 
00151 
00157 - (void)close;
00158 
00159 
00167 - (NSString *)version;
00168 
00169 
00179 - (NSString *)serialNumber;
00180 
00181 
00193 - (BOOL)isSleeping;
00194 
00195 
00203 - (void)setSleeping:(BOOL)flag;
00204 
00205 
00206 #pragma mark Channel Patching Functions
00207 
00217 - (BOOL)isChannelFree:(unsigned)aChannel;
00218 
00219 
00231 -(BOOL)isChannelFree:(unsigned)aChannel withBlockSize:(unsigned)blockSize;
00232 
00233 
00241 - (unsigned)firstFreeChannel;
00242 
00243 
00252 - (unsigned)firstFreeChannelWithSize:(unsigned)blockSize;
00253 
00254 
00265 - (unsigned)largestFreeBlock;
00266 
00267 
00279 - (unsigned)largestFreeBlockFromChannel:(unsigned)startingChannel;
00280 
00281 
00293 - (unsigned)largestFreeBlockAtChannel:(unsigned)startingChannel;
00294 
00295 
00301 - (void)setIsPatched:(BOOL)aPatch onChannel:(unsigned)aChannel;
00302 
00303 
00304 #pragma mark Transmit Functions
00305 
00313 - (BOOL)isTX;
00314 
00315 
00325 - (BOOL)setTX:(BOOL)flag;
00326 
00327 
00335 - (unsigned char)TXStartCode;
00336 
00337 
00347 - (BOOL)setTXStartCode:(unsigned char)theCode;
00348 
00349 
00357 - (unsigned int)TXLastChannel;
00358 
00359 
00369 - (BOOL)setTXLastChannel:(unsigned int)theChannel;
00370 
00371 
00379 - (BOOL)isBlackout;
00380 
00381 
00391 - (BOOL)setBlackout:(BOOL)flag;
00392 
00393 
00401 - (BOOL)setChannel:(unsigned int)theChannel toValue:(unsigned char)theValue;
00402 
00403 
00404 #pragma mark Receive Functions
00405 
00413 - (BOOL)isRX;
00414 
00415 
00425 - (BOOL)setRX:(BOOL)flag;
00426 
00427 
00435 - (unsigned char)RXStartCode;
00436 
00437 
00447 - (BOOL)setRXStartCode:(unsigned char)theCode;
00448 
00449 
00462 - (BOOL)requestRXFPS;
00463 
00464 
00477 - (BOOL)requestRXStartCode;
00478 
00479 
00492 - (BOOL)requestRXLastChannel;
00493 
00494 
00495 #pragma mark Deprecated Methods
00496 
00502 - (id)initWithSerialNumber:(NSString *)theSerialNumber;
00503 
00504 
00510 + (NSArray *)interfacePaths;
00511 
00512 @end
00513 
00514 
00515