Annotation of Examples/DriverKit/AMDPCSCSIDriver/SCSIInspector.m, revision 1.1.1.1

1.1       root        1: #import "SCSIInspector.h"
                      2: #import "configKeys.h"
                      3: 
                      4: #define MYNAME         "AMDInspector"
                      5: #define NIB_TYPE       "nib"
                      6: 
                      7: @implementation AMDInspector
                      8: 
                      9: /*
                     10:  * Find and load our nib, put a localized title atop the connector 
                     11:  * box, and init buttons. 
                     12:  */
                     13: - init
                     14: {
                     15:        char    buffer[MAXPATHLEN];
                     16:        NXBundle        *myBundle = [NXBundle bundleForClass:[self class]];
                     17:     
                     18:        [super init];
                     19:        
                     20:        if (![myBundle getPath:buffer forResource:MYNAME ofType:NIB_TYPE]) {
                     21:                [self free];
                     22:                return nil;
                     23:        }
                     24:        if (![NXApp loadNibFile:buffer owner:self withNames:NO]) {
                     25:                [self free];
                     26:                return nil;
                     27:        }
                     28:        return self;
                     29: }
                     30: 
                     31: /*
                     32:  * Get current values of the buttons from the existing 
                     33:  * config table. If the current table has no entry for specified
                     34:  * key, the associated button will be disabled.
                     35:  */    
                     36: 
                     37: - (void)_initButton : button   key : (const char *)key
                     38: {
                     39:        const char *value;
                     40:        int ival;
                     41: 
                     42:        value = [table valueForStringKey:key];
                     43:        if(value == NULL) {
                     44:                [button setState:0];
                     45:                [button setEnabled:0];
                     46:                return;
                     47:        }
                     48:        else if(strcmp(value, "YES") == 0) {
                     49:                ival = 1;
                     50:        }
                     51:        else {
                     52:                ival = 0;
                     53:        }
                     54:        [button setState:ival];
                     55: }
                     56: 
                     57: - setTable:(NXStringTable *)instance
                     58: {
                     59:        
                     60:        [super setTable:instance];
                     61:        [self setAccessoryView:boundingBox];
                     62:        [self _initButton:syncButton key:SYNC_ENABLE];
                     63:        [self _initButton:fastButton key:FAST_ENABLE];
                     64:        [self _initButton:cmdQueueButton key:CMD_QUEUE_ENABLE];
                     65:        return self;
                     66: }
                     67: 
                     68: 
                     69: - sync:sender
                     70: {
                     71:        int syncEnable;
                     72:        char *str;
                     73:        
                     74:        syncEnable = [sender state];
                     75:        if(syncEnable) {
                     76:                str = "YES";
                     77:        }
                     78:        else {
                     79:                str = "NO";
                     80:        }
                     81:        [table insertKey:SYNC_ENABLE value:str];
                     82:        return self;
                     83: }
                     84: 
                     85: - fast:sender
                     86: {
                     87:        int fastEnable;
                     88:        char *str;
                     89:        
                     90:        fastEnable = [sender state];
                     91:        if(fastEnable) {
                     92:                str = "YES";
                     93:        }
                     94:        else {
                     95:                str = "NO";
                     96:        }
                     97:        [table insertKey:FAST_ENABLE value:str];
                     98:        return self;
                     99: }
                    100: 
                    101: - cmdQueue:sender
                    102: {
                    103:        int cmdQueueEnable;
                    104:        char *str;
                    105:        
                    106:        cmdQueueEnable = [sender state];
                    107:        if(cmdQueueEnable) {
                    108:                str = "YES";
                    109:        }
                    110:        else {
                    111:                str = "NO";
                    112:        }
                    113:        [table insertKey:CMD_QUEUE_ENABLE value:str];
                    114:        return self;
                    115: }
                    116: 
                    117: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.