public class RemoteControlUI extends javax.swing.JFrame implements SocketProtocolListener, java.awt.event.ActionListener
Note this has been tested on both a real device and the Emulator. To use the Emulator you must have a working Emulator and AVD.
SampleCommand used to launch the emulator with an appropriate AVD:
emulator -no-snapstorage -avd SprintEvo
Steps to test the remote control concept:
ant debug
adb install -r bin\SAFSTCPMessenger-debug.apk
<instrumentation android:name="org.safs.android.engine.DSAFSTestRunner"
android:targetPackage="com.android.example.spinner"
android:label="General-Purpose SAFS Test Runner"/>
ant debug
adb install -r bin\SAFSTestRunner-debug.apk
adb forward tcp:2411 tcp:2410
adb shell am instrument -w org.safs.android.engine/org.safs.android.engine.DSAFSTestRunner
You should see a SAFS TCP Messenger notification appear in the notification area on the device\emulator and there should be logcat messages showing the status of the SAFS Test Runner registering with the SAFS TCP Messenger.
java org.safs.android.remotecontrol.RemoteControlUI
SAFSRemoteControl,
Serialized Formjavax.swing.JFrame.AccessibleJFramejava.awt.Window.AccessibleAWTWindow, java.awt.Window.Type| Modifier and Type | Field and Description |
|---|---|
(package private) javax.swing.JTextField |
cmdField |
(package private) javax.swing.JLabel |
cmdLabel |
(package private) java.lang.String |
connectAction |
(package private) javax.swing.JButton |
connectButton |
(package private) javax.swing.JPanel |
controls |
(package private) java.lang.String |
dispatchPropsAction |
(package private) javax.swing.JButton |
dispatchPropsButton |
(package private) java.util.Properties |
props |
(package private) java.lang.String |
sendAction |
(package private) javax.swing.JButton |
sendButton |
(package private) SAFSRemoteControl |
server |
(package private) java.lang.String |
shutdownAction |
(package private) javax.swing.JButton |
shutdownButton |
(package private) javax.swing.JTextField |
status |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabledCROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDEFAULT_NAME| Constructor and Description |
|---|
RemoteControlUI() |
RemoteControlUI(java.lang.String title) |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
(package private) void |
createUI() |
protected void |
disableInteraction() |
protected void |
enableInteraction() |
(package private) java.util.Properties |
fillProperties() |
java.lang.String |
getListenerName()
Unique name to identify the listener.
|
static void |
main(java.lang.String[] args)
java org.safs.android.RemoteControlUI
|
(package private) void |
onConnectAction() |
(package private) void |
onDispatchPropsAction() |
void |
onReceiveConnection()
Called when a 2-way sockets connection has been established.
|
void |
onReceiveDebug(java.lang.String message) |
void |
onReceiveException(java.lang.String message)
Remote client has thrown/issued an Exception message.
|
void |
onReceiveLocalShutdown(int cause)
A local source has issued a SHUTDOWN event/command.
|
void |
onReceiveMessage(java.lang.String message)
Remote client has sent an arbitrary message.
|
void |
onReceiveReady()
Remote client has issued the READY event
|
void |
onReceiveRemoteShutdown(int cause)
A remote source has issued a SHUTDOWN event/command.
|
void |
onReceiveResult(int rc,
java.lang.String info)
Remote client has issued the RESULT event and is returning a simple statuscode and statusinfo response.
|
void |
onReceiveResultProperties(java.util.Properties result)
Remote client has issued the RESULT event and is returning result information in Properties.
|
void |
onReceiveRunning()
Remote client has issued the RUNNING event--usually resulting from a DISPATCH event.
|
(package private) void |
onSendAction() |
(package private) void |
onShutdownAction() |
protected void |
shutdownRemoteControl() |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleSAFSRemoteControl server
javax.swing.JPanel controls
javax.swing.JLabel cmdLabel
javax.swing.JTextField cmdField
java.lang.String sendAction
java.lang.String connectAction
java.lang.String shutdownAction
java.lang.String dispatchPropsAction
javax.swing.JButton sendButton
javax.swing.JButton connectButton
javax.swing.JButton shutdownButton
javax.swing.JButton dispatchPropsButton
javax.swing.JTextField status
java.util.Properties props
public RemoteControlUI()
throws java.awt.HeadlessException
java.awt.HeadlessExceptionpublic RemoteControlUI(java.lang.String title)
throws java.awt.HeadlessException
java.awt.HeadlessExceptionjava.util.Properties fillProperties()
void createUI()
void onConnectAction()
void onSendAction()
void onDispatchPropsAction()
void onShutdownAction()
protected void disableInteraction()
protected void enableInteraction()
public java.lang.String getListenerName()
NamedListenergetListenerName in interface NamedListenerpublic void onReceiveConnection()
ConnectionListeneronReceiveConnection in interface ConnectionListenerpublic void onReceiveDebug(java.lang.String message)
public void onReceiveReady()
SocketProtocolListeneronReceiveReady in interface SocketProtocolListenerpublic void onReceiveRunning()
SocketProtocolListeneronReceiveRunning in interface SocketProtocolListenerpublic void onReceiveResult(int rc,
java.lang.String info)
SocketProtocolListeneronReceiveResult in interface SocketProtocolListenerrc - -- int statuscodeinfo - -- String statusinfo. Can be null. Can be an empty string.public void onReceiveResultProperties(java.util.Properties result)
SocketProtocolListeneronReceiveResultProperties in interface SocketProtocolListenerpublic void onReceiveMessage(java.lang.String message)
SocketProtocolListeneronReceiveMessage in interface SocketProtocolListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic static void main(java.lang.String[] args)
args - -- noneprotected void shutdownRemoteControl()
public void onReceiveLocalShutdown(int cause)
ConnectionListeneronReceiveLocalShutdown in interface ConnectionListenercause - is used to indicate whether the shutdown is due to normal
or abnormal circumstances.SocketProtocol.STATUS_SHUTDOWN_NORMAL,
SocketProtocol.STATUS_SHUTDOWN_REMOTE_CLIENTpublic void onReceiveRemoteShutdown(int cause)
ConnectionListeneronReceiveRemoteShutdown in interface ConnectionListenercause - is used to indicate whether the shutdown is due to normal
or abnormal circumstances.SocketProtocol.STATUS_SHUTDOWN_NORMAL,
SocketProtocol.STATUS_SHUTDOWN_REMOTE_CLIENTpublic void onReceiveException(java.lang.String message)
SocketProtocolListeneronReceiveException in interface SocketProtocolListenerCopyright © SAS Institute. All Rights Reserved.