Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

IODeviceInspector



Inherits From: Object
Conforms To: IOConfigurationInspector
Declared In: driverkit/IODeviceInspector.h



Class Description

This class provides the default Configure inspector used for devices. IODeviceInspector lets the user select which resources--DMA channels, interrupts, I/O ports, and memory ranges--a device should use. IODeviceInspector also provides an accessory View, in which you can put additional controls.

You shouldn't need to use this class unless you're providing an accessory View. To provide an accessory View, you should first create the View in Interface Builder and then subclass IODeviceInspector so that it displays the View.

Note:  When creating an accessory View, try to keep it no more than 80 pixels high. Configure's window is already about 400 pixels high; adding more than 80 pixels to it means that the window won't fit on the smallest supported screens (which are 640 pixels wide by 480 high).



Implementing a Subclass

To provide an accessory View, you should create an IODeviceInspector subclass that does the following:

Overrides Object's init method so that it loads the nib file that contains the accessory View by invoking loadMainNibFile and initializing (but not displaying) the interrupt and DMA matrices.
Implement the setTable: method so that it invokes [super setTable:], invokes setAccessoryView: to specify its accessory View, and initializes the accessory View
Modifies the configuration table as necessary, in response to the user's actions in the accessory View. For example, you might need to insert a key in the configuration table.

Here's an example of changing the configuration table when the user operates a control. In this case, the control sends a connectorChanged: message to its target (which is the IODeviceInspector subclass). The table instance variable is the NXStringTable corresponding to the configuration table.

- connectorChanged:sender
{
[table insertKey:CONNECTOR
value:connectorType[sender selectedTag]];
return self;
}

If you have localizable strings displayed in your accessory View, be careful to use the strings from the driver's configuration bundle, not from the Configure application's bundle. Here's an example taken from an IODeviceInspector subclass's init method.

#define LOCAL_CONNECTOR_STRING(bundle)  NXLocalStringFromTableInBundle(NULL, bundle, "Connector", NULL, "The interface connector on the EtherExpress16 adaptor which will be used to access the network.")
.
.
.
char      buffer[MAXPATHLEN];
NXBundle *myBundle = [NXBundle bundleForClass:[self class]];

[super init];

if (![myBundle getPath:buffer forResource:MYNAME ofType:NIB_TYPE]) {
[self free];
return nil;
}
if (![NXApp loadNibFile:buffer owner:self withNames:NO]) {
[self free];
return nil;
}
[connectorBox setTitle:LOCAL_CONNECTOR_STRING(myBundle)];



Instance Variables

id accessoryHolder;

id statusTitle;

id origWindow;

id dmaBox;

id dmaMatrix;

id irqBox;

id irqMatrix;

id memoryBox;

id memoryController;

id portsBox;

id portsController;

id inspectionView;

id infoButton;

id infoPanel;

id infoText;

NXStringTable *table;

int numInterrupts;

int numChannels;

int portRangeLength;

int memoryRangeLength;

BOOL infoTextLoaded;

BOOL knowsDetails;

IOConfigurationConflict portConflict;

IOConfigurationConflict memoryConflict;

IOConfigurationConflict totalConflict;


accessoryHolder View where the accessory View is placed
statusTitle At top of window
origWindow For getting contentView
dmaMatrix Buttons for DMA channels
dmaBox In case no DMA channels
irqMatrix Buttons for IRQ levels
irqBox In case no IRQ levels
memoryController Handles ranges
memoryBox In case no mapped memory
portsController Handles ranges
portsBox In case no port addresses
inspectionView The inspection View
infoButton Brings up device info panel
infoPanel Contains text about the device
infoText Text object for info file
table The NXStringTable we're editing
numInterrupts How many IRQs to configure
numChannels How many DMA channels to configure
portRangeLength Number of I/O ports in the range
memoryRangeLength Length of the memory map
infoTextLoaded YES if the info panel has been loaded
knowsDetails YES if we already know the device's requirements
portConflict I/O port conflict state
memoryConflict Memory range conflict state
totalConflict Overall conflict state



Adopted Protocols

IOConfigurationInspector inspectionView
resourcesChanged:
setTable:



Method Types

Displaying the IODeviceInspector
loadMainNibFile
showInfo:
Setting initial resource values setNumInterrupts:numChannels:portRangeLength:
memoryRangeLength:
Notification of resource changes channelOrInterruptPicked:
rangeDidChange:
Customizing the IODeviceInspector
setAccessoryView:



Instance Methods

channelOrInterruptPicked:
channelOrInterruptPicked:sender

Notifies the receiver that a DMA channel or interrupt has been picked. IODeviceInspector changes the appearance the associated button and updates the configuration table, if appropriate. Returns self.



loadMainNibFile
loadMainNibFile

Loads the nib file for the IODeviceInspector. This method should be invoked by init. Returns nil on failure; otherwise, returns self.



rangeDidChange:
rangeDidChange:sender

Notifies the receiver that a range of I/O ports or memory has been changed. This method updates the configuration table. Returns self.



setAccessoryView:
setAccessoryView:aView

Adds aView to the IODeviceInspector's View hierarchy. The inspector is automatically resized to accommodate aView. Returns self.



setNumInterrupts:numChannels:portRangeLength: memoryRangeLength:
setNumInterrupts:(int)numInterrupts
numChannels:(int)numChannels
portRangeLength:(int)numPorts
memoryRangeLength:(int)numMaps

Invoked once by setTable: to initialize the number of each kind of resource that the device uses.



showInfo:
showInfo:sender

Brings up a panel containing information about the device.