connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/api/IDeviceDiscoveryAgent.java
author stechong
Wed, 20 Oct 2010 11:19:31 -0500
changeset 2165 2a7b5eccb0bc
parent 1544 93a010393cd9
permissions -rw-r--r--
Keeping PlatSim internal only.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
688
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     1
/**
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     3
* All rights reserved.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     8
*
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
     9
* Initial Contributors:
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    11
*
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    12
* Contributors:
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    13
*
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    14
* Description: 
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    15
*
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    16
*/
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    17
700
9441b6037cb6 rename internal api package to internal.api
dadubrow
parents: 688
diff changeset
    18
package com.nokia.carbide.remoteconnections.internal.api;
688
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    19
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    20
import java.net.URL;
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    21
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    22
import org.eclipse.core.runtime.CoreException;
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    23
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    24
/**
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    25
 * An interface to a device discovery agent
899
b5675f3e69ad update since tags to 2.5
dadubrow
parents: 849
diff changeset
    26
 * @since 2.5
688
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    27
 */
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    28
public interface IDeviceDiscoveryAgent {
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    29
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    30
	/**
849
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    31
	 * An interface for discovery agents to implement that the manager uses
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    32
	 * before loading the agent to get errors about required components.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    33
	 * <p>
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    34
	 * Every discovery agent must implement this interface.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    35
	 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    36
	public interface IPrerequisiteStatus {
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    37
		/**
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    38
		 * Is the status OK?
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    39
		 * @return boolean 
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    40
		 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    41
		boolean isOK();
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    42
		/**
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    43
		 * If status is not OK, return error message text.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    44
		 * @return String
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    45
		 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    46
		String getErrorText();
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    47
		/**
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    48
		 * Optionally return a URL for user to browse to for more information on error.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    49
		 * @return URL
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    50
		 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    51
		URL getURL();
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    52
		
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    53
	}
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    54
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    55
	/**
688
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    56
	 * Starts agent. Once started, runs until stopped.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    57
	 * @throws CoreException
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    58
	 */
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    59
	void start() throws CoreException;
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    60
	
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    61
	/**
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    62
	 * Stops agent.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    63
	 * @throws CoreException
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    64
	 */
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    65
	void stop() throws CoreException;
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    66
	
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    67
	/**
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    68
	 * Returns a URL to specific information about this discovery mechanism,
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    69
	 * troubleshooting, etc.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    70
	 * @return URL
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    71
	 */
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    72
	URL getInformation();
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
    73
	
849
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    74
	/**
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    75
	 * Returns a display name for the particular discovery agent in case we need to
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    76
	 * let the user know errors from the agents.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    77
	 * @return String
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    78
	 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    79
	String getDisplayName();
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    80
	
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    81
	/**
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    82
	 * Manager will call this to get any status of prerequisites not satisfied before
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    83
	 * the manager calls start(). The agent should check its prerequisites at this time.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    84
	 * <p>
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    85
	 * If the agent has no prerequisites return a status of OK.
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    86
	 * @return IPrerequisiteStatus
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    87
	 */
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    88
	IPrerequisiteStatus getPrerequisiteStatus();
d8886f16bea3 Add dialog to notify user of discovery agents not loaded because prerequisites not satisfied. Bug 10486
Chad Peckham <chad.peckham@nokia.com>
parents: 700
diff changeset
    89
	
1544
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    90
	/**
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    91
	 * Return whether this discovery agent is running
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    92
	 * @return boolean
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    93
	 */
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    94
	boolean isRunning();
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    95
	
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    96
	/**
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    97
	 * The unique id for this agent
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    98
	 * @return String
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
    99
	 */
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
   100
	String getId();
93a010393cd9 Bug 11222
dadubrow
parents: 899
diff changeset
   101
	
688
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   102
	// In addition, there may need to be an additional API to do a deeper form of discovery for
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   103
	// connection mechanisms that require pairing (like BT or Wifi). In these cases, normal discovery
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   104
	// will probably be for already paired devices, however, the user will want to discover all 
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   105
	// potential devices from some UI in order to set up a paired device.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   106
	// A method for doing this will need to be added.
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   107
	
ae5ff180a61d Changes to remote connections
dadubrow
parents:
diff changeset
   108
}