//
//  computer.h
//  Device Explorer
//
//  Created by otusweb on Thu Jun 20 2002.
//  Copyright (c) 2002 Texas Instruments Inc.. All rights reserved.
//
//Feb 2010: Changes Made by a0869729 (Srinath Madas) as part of Issue id 83322 for deprecated symbols on 10.6

#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "DeviceFolder.h"
#import "Device.h"

/*"key containing the errors returned when sending the file content on send operation"*/
extern NSString* sendResultOperationResult;

/*"notifications"*/
extern NSString* deviceAddedNotification;
extern NSString* deviceRemovedNotification;
extern NSString* comManagerDiedNotification;


@interface TIComputer : TIDeviceFolder<NSCopying,NSNetServiceBrowserDelegate> /*"TIDeviceObject"*/
{
    @private
    NSString *address;				/*"Address as passed in by the user"*/
    NSString *eppcAddress;			/*"Fully formed address to send an event to the device"*/
    OSType _targetCreatorCode;			/*"TI com manager creator code"*/
    NSNumber* registrationTransactionID;	/*"Registration event transactionID, is used by the com manager for removal of notification"*/
    NSTimer *thePollingTimer;
    id loginReplyTarget;
    NSTimer *statusResfreshTimer; 		/*"timer used to get the progress data from com manager"*/
    BOOL isGettingIOStatus;
    BOOL isRefreshing;
    NSNetServiceBrowser *bonjourController;
    NSArray *ioStatusDevices;
}


/*"initialiser"*/
+ (TIComputer*) computerWithAddress: (NSString*) inAddress
                               name: (NSString*) inName
                          container: (TIDeviceFolder*) inContainer;
- (id) initWithContainer: (TIDeviceFolder*) inContainer
                    name: (NSString*)inName
                 address: (NSString*) inAddress;

/*"Actions"*/
- (void) waitForLoginForDevices: (NSArray*) devices callingCompletionOn: (id)target;
- (void) registerWithComManagerCallingCompetionOn:(id)target;
- (void) unregisterCallingCompetionOn:(id)target;
- (void) unmountDeviceNamed: (NSString*) inName;
- (void) loadContent;
- (void) reaquireDevicesCallingCompetionOn:(id)target;
- (void) refreshDevices;
- (void) refreshDevicesInCurrentThread;
- (void)  reacquireUnknownDevices;
- (void) getProperty: (NSString*) inProperty fromDevices:(NSArray*) inDevice callingCompletionOn: (id)target;
- (NSAppleEventDescriptor*) getProperty: (NSString*) inProperty fromDevices:(NSArray*) inDevice;

    /*"Accessors"*/
- (NSString *) address;
- (NSString *) eppcAddress;
- (OSType) targetCreatorCode;
- (NSNumber*) registrationTransactionID;
- (BOOL) isRemote;
- (BOOL) isRefreshing;
- (BOOL) isGettingStatusOfDevice: (TIDevice*) inDevice;
+ (TIComputer*) defaultComputer;
- (void) setSelfAsDefaultComputer;

    /*"subitems accessors"*/
- (TIComputer*) ComputerWithTransactionID:(NSNumber*)inTransactionID;
- (TIComputer*) computerWithAddress:(NSString*)inAddress;
- (TIDevice*) deviceWithName:(NSString*)inName;
- (TIDevice*) deviceWithID:(NSString*)inID;
- (NSArray*) devicesOfNonHumanReadableKind:(NSString*)inKind;
- (NSArray*) subComputers;
- (NSArray*) devices;
- (NSArray*) directSubDevices;
- (void) addSubObjectsNoDuplicate: (NSArray*) inObjects;

    /*"Utility"*/
- (void) makeNewDeviceWithSpecifier:(NSAppleEventDescriptor*) inDescriptor;
- (void) setPollingTimerFiringDate:(NSDate*) inFireDate;
+ (NSDictionary*) groupFilesByComputer: (NSArray*) inFiles;
- (void) installRegistrationHandlers;
@end

@interface NSObject (TIComputerDelegate)
/*"Delegate method that are called when the registration process has completed either with success or failure"*/
- (void) computer: (TIComputer*) sender computerRemoved:(TIComputer*) computerRemoved;
- (void) computerdoneLoadingContent: (TIComputer*) sender;
- (void) computer: (TIComputer*) sender connectionLostWithReason: (NSDictionary*) reason;
- (void) computer: (TIComputer*) sender deviceRemoved:(TIDevice*) deviceRemoved;
- (void) computer: (TIComputer*) sender deviceAdded:(TIDevice*) deviceAdded;
- (void) computer: (TIComputer*) sender invalidDevice:(TIDevice*) deviceAdded error: (TIDeviceError) error;
- (BOOL) comManagerDiedShouldRelaunchOnComputer: (TIComputer*) sender;
@end

@interface NSObject (TIComputerCompletionRoutine)
/*"Method called when an action is completed. Those message are sent to the target passed in when the function was called"*/
- (void) computer: (TIComputer*) sender doneRegisteringWithResult:(OSStatus) result;
- (void) computer: (TIComputer*) sender doneUnregisteringWithResult:(OSStatus) result;
- (void) computer: (TIComputer*) sender doneSendingReaquire:(OSStatus) result;
- (void) computer: (TIComputer*) sender receivedProperty:(NSAppleEventDescriptor*) result property:(NSString*) property fromDevices: (NSArray*) devices;
@end

//@interface TIComputer: NSObject <NSNetServiceBrowserDelegate>
//{
//- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser
//didRemoveService:(NSNetService *)aNetService
//moreComing:(BOOL)moreComing;
//}

	
