//
//  TIComOperation.h
//  Device Explorer
//
//  Created by otusweb on Fri May 02 2003.
//  Copyright (c) 2003 Texas Instruments Incorporated. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Computer.h"
#import "Device.h"
#import "NSAppleEventDescriptorCategory.h"
#import "NSArray+CustomPerformSelector.h"

@interface TIComOperation : NSObject
{
    NSMutableDictionary *result;        /*"the result of the operation"*/
    NSMutableArray *subOperations;      /*"If communicating with several computer then subOperation will be needed"*/
    TIComputer *targetComputer;         /*"the computer to which the event will be sent (only present if no subOperation)"*/
    NSMutableArray *deviceTalkedTo;     /*"An array grouping all the device this operation talks too"*/
    id target;                          /*"the object to which notification of completion will be sent"*/
    id option;                          /*"used by some subclass"*/
    NSMutableArray *remainingDestinations;  /*"destination to which the operation has not been performed yet"*/
    NSNumber *transactionID;            /*"the transactionID of the event send (only present if no subOperation)"*/
    NSMutableArray *differedOperationTimers;/*"if some operation need to be differed because the device is busy then this timer is used"*/
        TIComOperation *containerOperation;
}

/*"Initializer"*/
- (id) initWithOption: (NSString*) inOption sendingCompletionCallTo: (id) target;

/*"Accessors"*/
- (NSMutableDictionary *) result;
- (NSArray *) subOperations;
- (TIComputer *) targetComputer;
- (NSMutableArray *) devicesTalkedTo;
+ (NSMutableArray*) comOperations;
- (NSMutableArray*) comOperations;
- (id) target;
- (id) option;
- (BOOL) isDone;
- (TIComOperation *) containerOperation;
- (void) setContainerOperation:(TIComOperation *)newContainerOperation;

    /*"Actions"*/
- (void) execute;
- (void) cancel;
- (void) redo;
@end


@interface NSObject (TIComOperationCompletion)
- (void) TIComOperation: (TIComOperation*) sender doneWithResult:(NSDictionary*) inResult;
@end