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.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: LOHWManager.h 260 2010-11-11 18:58:13Z ben.suffolk $
00033  *
00034  */
00035 
00036 #import <Cocoa/Cocoa.h>
00037 @class LOHWBridge;
00038 
00039 #define LOHWManagerDidUpdatePatch @"LOHWManagerDidUpdatePatch"
00040 #define LOHWManagerBridgePluggedNotification @"LOHWManagerBridgePluggedNotification"
00041 #define LOHWManagerBridgeUnpluggedNotification @"LOHWManagerBridgeUnpluggedNotification"
00042 
00043 #define LOHWManagerUnidentifiedPlugNotification @"LOHWManagerUnidentifiedPlugNotification"
00044 #define LOHWManagerUnidentifiedUnplugNotification @"LOHWManagerUnidentifiedUnplugNotification"
00045 
00046 
00054 @interface LOHWManager : NSObject
00055 {
00056  NSDictionary *knownDevices; 
00057  NSMutableDictionary *unknownDevices; 
00058 
00059  NSMutableArray *pluggedIdentifiers; 
00060 
00061  NSMutableArray *universes; 
00062  NSMutableArray *bridges;   
00063 
00064  IONotificationPortRef  notifyPort;
00065  io_iterator_t  usbIterator;
00066 }
00067 
00068 
00078 + (LOHWManager *)defaultManager;
00079 
00080 
00086 - (unsigned)count;
00087 
00088 
00103 - (void)autopatch;
00104 
00105 
00118 - (void)patchFromXML:(NSXMLElement *)XMLElement;
00119 
00120 
00134 - (LOHWBridge *)bridgeForUniverse:(unsigned char)universe addingDummy:(BOOL)flag;
00135 
00136 
00145 - (LOHWBridge *)bridgeForIdentifier:(NSString *)identifier;
00146 
00147 
00156 - (LOHWBridge *)bridgeForIdentifier:(NSString *)identifier andPatch:(BOOL)flag;
00157 
00158 
00166 - (unsigned char)universeForBridge:(LOHWBridge *)bridge;
00167 
00168 
00184 - (void)patchBridge:(LOHWBridge *)bridge toUniverse:(unsigned char)universe;
00185 
00186 
00192 - (void)moveUniversesAtIndexs:(NSIndexSet *)indexes toIndex:(unsigned)index;
00193 
00194 
00201 - (void)removeUniverseAtIndex:(unsigned)index;
00202 
00203 
00209 - (void)closeAll;
00210 
00211 
00221 - (NSArray *)identifers;
00222 
00223 
00239 - (NSXMLElement *)XML;
00240 
00241 
00250 - (void)setBlackout:(BOOL)state;
00251 
00252 
00263 - (NSArray *)unpatchedBridgeIdentifiers;
00264 
00265 
00273 - (NSArray *)patchedBridgeIdentifiers;
00274 
00275 
00281 - (void)setSleeping:(BOOL)flag;
00282 
00283 
00293 - (NSDictionary *)knownDevices;
00294 
00295 
00303 - (void)setKnownDevices:(NSDictionary *)devices;
00304 
00305 
00312 - (NSDictionary *)unknownDevices;
00313 
00314 
00315 #pragma mark Deprecated Functions
00316 
00328 - (LOHWBridge *)bridgeWithSerial:(NSString *)serial;
00329 
00330 @end
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354