|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.Errorable
ewe.io.RemoteConnection
This class provides services to allow ewe applications on a desktop to communicate with ewe applications on a mobile pc when they are connected. On a Windows PC this connection is provided by the ActiveSync service.
When such a connection is made native applications on the desktop and mobile PC are run and this provides a constant streaming connection between the two devices. The RemoteConnection class then provides an API to access the services provided by the underlying connection.
| Field Summary | |
static int |
AUTO_START_EMULATOR
|
static int |
AUTO_START_IS_EWE_APPLICATION
This registers an auto-start entry which will start when ewesync begins. |
static int |
AUTO_START_SERVICE
|
int |
connectTimeOut
This is a time in milliseconds for timing out a connection between the ewe application and the underlying RemoteConnection. |
static int |
IS_DESKTOP
This is returned by getStatus(). |
static int |
IS_MOBILE
This is returned by getStatus(). |
static int |
MANUAL_MOBILE_START_ON_EMULATOR
|
static int |
MOBILE_GET_COMMAND_FROM_REGISTRY
|
static int |
MOBILE_IS_EWE_APPLICATION
|
| Fields inherited from class ewe.util.Errorable |
error |
| Constructor Summary | |
protected |
RemoteConnection()
|
| Method Summary | |
Socket |
connectToHost(String hostName,
int port)
This is used by an application to connect to a host and port which is accessible from the remote machine (including the remote machine itself). |
Socket |
connectToService(String service)
This is used by an application to connect to a service on the remote machine. |
static ServerSocket |
createService(String serviceName)
This creates a ServerSocket on a new port and then posts the service to the RemoteConnecion. |
void |
execRemote(String[] commandLines,
int execOptions)
Run command lines on the remote. |
void |
execRemote(String commandLine,
int execOptions)
Run a command line on the remote. |
static RemoteConnection |
getConnection()
Use this to get an instance of a RemoteConnection. |
static RemoteConnection |
getInstance()
Deprecated. use getConnection() instead. |
static RemoteConnection |
getNewConnection()
Use this to get a new instance of a RemoteConnection. |
String |
getRegistryValue(String keyName)
|
int |
getStatus()
This is used to check the RemoteConnection status. |
Socket |
getSyncConnection(String serviceName,
String remoteCommandLine,
boolean remoteIsEweApp,
TimeOut howLong)
|
boolean |
isEmulated()
This returns true if the RemoteConnection is running on an EweSync Emulator. |
static void |
main(String[] args)
|
Socket |
makeSyncConnection(String serviceName,
String[] commandLines,
TimeOut howLong,
int makeOptions)
This is a convenience method for doing standard application synchronization that can be be run on both the desktop and mobile device. |
Socket |
makeSyncConnection(String serviceName,
String commandLine,
TimeOut howLong,
int makeOptions)
This is a convenience method for doing standard application synchronization that can be be run on both the desktop and mobile device. |
boolean |
postService(String service,
ServerSocket serverSocket)
This is used by an application to notify the connection that it has created and is listening to a TCP/IP server port on the specified hostName and port number. |
boolean |
postService(String service,
String hostName,
int port)
This is used by an application to notify the connection that it has created and is listening to a TCP/IP server port on the specified hostName and port number. |
static void |
registerAutoStart(String entryName,
String commandLine,
int typeAndOptions)
Use this to register an AutoStart entry. |
static void |
registerAutoStartEweApp(String entryName,
String eweCommandLine)
This registers a normal autostart entry specifying the entry name and a command line that is taken to be a Ewe application. |
boolean |
runRemoteApp(String commandLine)
Deprecated. use execRemote() instead. |
boolean |
runRemoteEwe(String eweCommandLine)
Deprecated. use execRemote() instead. |
| Methods inherited from class ewe.util.Errorable |
returnError, returnError, returnError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public int connectTimeOut
public static final int IS_DESKTOP
public static final int IS_MOBILE
public static final int AUTO_START_IS_EWE_APPLICATION
public static final int AUTO_START_EMULATOR
public static final int AUTO_START_SERVICE
public static final int MOBILE_IS_EWE_APPLICATION
public static final int MANUAL_MOBILE_START_ON_EMULATOR
public static final int MOBILE_GET_COMMAND_FROM_REGISTRY
| Constructor Detail |
protected RemoteConnection()
| Method Detail |
public static RemoteConnection getConnection()
throws IOException
IOException - if there is an error getting the connection.
public static RemoteConnection getNewConnection()
throws IOException
IOException - if there is an error getting the connection.public static RemoteConnection getInstance()
public boolean runRemoteApp(String commandLine)
runRemoteApp("\"\\Program Files\\Calculator.exe\"");
commandLine - The command line to run, including program arguments.
public boolean runRemoteEwe(String eweCommandLine)
runRemoteEwe("\"\\Program Files\\MyApp.ewe\"");
public void execRemote(String[] commandLines,
int execOptions)
throws IOException
commandLines - The line to run or remote Registry value that stores the command to be run.execOptions - This can be any of MOBILE_GET_COMMAND_FROM_REGISTRY, MOBILE_IS_EWE_APPLICATION, OR'ed together.
IOException - If the command could not be executed.
public void execRemote(String commandLine,
int execOptions)
throws IOException
commandLine - The line to run or remote Registry value that stores the command to be run.execOptions - This can be any of MOBILE_GET_COMMAND_FROM_REGISTRY, MOBILE_IS_EWE_APPLICATION, OR'ed together.
IOException - If the command could not be executed.
public boolean postService(String service,
String hostName,
int port)
service - The service name to post. Note that this IS case sensitive.hostName - The name of the host used for the connection.port - The port number of the connection.
public boolean postService(String service,
ServerSocket serverSocket)
service - The service name to post. Note that this IS case sensitive.serverSocket - The socket being listened to.
public static ServerSocket createService(String serviceName)
throws IOException
serviceName - The name of the service to be posted.
IOException - If ther ServerSocket could not be created or if the service
could not be posted.
public Socket connectToHost(String hostName,
int port)
public Socket connectToService(String service)
public String getRegistryValue(String keyName)
public int getStatus()
public boolean isEmulated()
public static void registerAutoStart(String entryName,
String commandLine,
int typeAndOptions)
throws IOException
entryName - A unique name for the entry. You can use spaces or special characters,
but not the backslash (\) character.commandLine - The command line to run. This should be a full command line, or it can
be a command line to the EweVM if the AUTO_START_IS_EWE_APPLICATION option is chosen.typeAndOptions - This can be a combination of AUTO_START_IS_EWE_APPLICATION with
AUTO_START_EMULATOR or AUTO_START_SERVICE. If neither AUTO_START_EMULATOR nor AUTO_START_SERVICE
is selected, then it is assumed that the entry is in the normal (default) auto start section.
IOException - If the information could not be registerd.
public static void registerAutoStartEweApp(String entryName,
String eweCommandLine)
throws IOException
entryName - A unique name for the entry. You can use spaces or special characters,
but not the backslash (\) character.
IOException - If the information could not be registerd.
public Socket makeSyncConnection(String serviceName,
String commandLine,
TimeOut howLong,
int makeOptions)
throws TimedOutException,
IOException,
InterruptedException
If it is running on the desktop it will do the following:
1. Create a server socket on an arbitrary port.
2. Post the service name and the socket port.
3. Execute the remote command line, unless the MANUAL_MOBILE_START_ON_EMULATOR
option is selected in which case a MessageBox is shown if the connection
is running on the Ewesync Emulator and you must start the mobile app yourself.
If the MOBILE_GET_COMMAND_FROM_REGISTRY option is used, then the command line supplied should
be the name of a value in the registry key - this value will be retrieved and then run.
If MOBILE_IS_EWE_APPLICATION option is used then the value retrieved from the registry
should be the location of a .ewe file.
4. Wait for a connection.
If it is running on the mobile this method will:
1. Attempt to connect to the serviceName on the remote host.
serviceName - The unique service name to be used.commandLine - A command line to pass to the Ewe VM on the remote device.howLong - The length of time to wait for a connection.makeOptions - This can be any of MANUAL_MOBILE_START_ON_EMULATOR, MOBILE_IS_EWE_APPLICATION OR'ed together.
TimedOutException - If no connection was made during the Timeout period.
IOException - If there was an error making the connection.
InterruptedException
public Socket makeSyncConnection(String serviceName,
String[] commandLines,
TimeOut howLong,
int makeOptions)
throws TimedOutException,
IOException,
InterruptedException
If it is running on the desktop it will do the following:
1. Create a server socket on an arbitrary port.
2. Post the service name and the socket port.
3. Execute the remote command lines, unless the MANUAL_MOBILE_START_ON_EMULATOR
option is selected in which case a MessageBox is shown if the connection
is running on the Ewesync Emulator and you must start the mobile app yourself.
If the MOBILE_GET_COMMAND_FROM_REGISTRY option is used, then the command lines supplied should
be the name of a value in the registry key - this value will be retrieved and then run.
If MOBILE_IS_EWE_APPLICATION option is used then the value retrieved from the registry
should be the location of a .ewe file.
4. Wait for a connection.
If it is running on the mobile this method will:
1. Attempt to connect to the serviceName on the remote host.
serviceName - The unique service name to be used.commandLines - An array of command lines to pass to the Ewe VM on the remote device.howLong - The length of time to wait for a connection.makeOptions - This can be any of MANUAL_MOBILE_START_ON_EMULATOR, MOBILE_IS_EWE_APPLICATION OR'ed together.
TimedOutException - If no connection was made during the Timeout period.
IOException - If there was an error making the connection.
InterruptedException
public Socket getSyncConnection(String serviceName,
String remoteCommandLine,
boolean remoteIsEweApp,
TimeOut howLong)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||