Packagecom.esri.tracking.connector
Classpublic class Connector
InheritanceConnector Inheritance flash.events.EventDispatcher

The main class used to connect to the Tracking Server gateway. This class is used to connect to Tracking Server, authenticate a user, get services, subscribe and unsubscribe to services and for other messaging to the Tracking Server gateway.

View the examples



Public Properties
 PropertyDefined By
  isConnected : Boolean
[read-only] Indicates whether the socket connection is open or not.
Connector
  isLoggedIn : Boolean
[read-only] Indicates whether or not currently logged in to the Tracking Server.
Connector
  messageFormatManager : MessageFormatManager
[read-only] Gets most recent MessageFormatManager returned by the Tracking Server.
Connector
  password : String
[read-only] Gets most recent password used to log in.
Connector
  port : int
[read-only] Gets most recent port number used to connect.
Connector
  remoteHostname : String
[read-only] Gets most recent hostname used to connect.
Connector
  username : String
[read-only] Gets username used to log in.
Connector
Public Methods
 MethodDefined By
  
The constructor.
Connector
  
authenticateAsync(username:String, password:String):void
Authenticates with the Tracking Server using the provided username and password.
Connector
  
connectAsync(remoteHostname:String, port:int):void
Connects asynchronously to given remoteHostname at given port.
Connector
  
disconnectAsync(preserveSession:Boolean):void
Disconnects connection and closes socket to gateway.
Connector
  
Sends a request to the Tracking Server for available actions.
Connector
  
getAuxiliaryDataAsync(serviceName:String):void
Sends a request to the Tracking Server for the auxiliary data of a complex service.
Connector
  
getGatewayStatisticsAsync(array:Array):void
Connector
  
Sends a request to the Tracking Server for service definitions available to the current user.
Connector
  
Gets most recent list of services available.
Connector
  
Gets the list of subscribed services.
Connector
  
getSymbolFromIDAsync(symbolId:String, imgSize:int, isMOLESymbol:Boolean):void
Sends a request to the Tracking Server for a symbol.
Connector
  
getSymbolFromXMLAsync(xmlRequest:String, isMOLESymbol:Boolean):void
Sends a request to the Tracking Server for a symbol.
Connector
  
Gets the list of unsubscribed services.
Connector
  
setAOIForServiceAsync(serviceName:String, aoiEnvelope:TmsEnvelope, aoiType:SetAOIType):Boolean
Publishes a message to other clients connected to the gateway, including the client publishing the message.
Connector
  
subscribeToServiceAsync(serviceName:String):void
Sends a request to the gateway to subscribe to a single service.
Connector
  
subscribeToServiceListAsync(subscribeServiceNames:Array):void
Sends a request to the gateway to subscribe to a list of services.
Connector
  
unsubscribeFromServiceAsync(serviceName:String):void
Sends a request to the gateway to unsubscribe from a single service.
Connector
  
unsubscribeFromServiceListAsync(unsubscribeServiceNames:Array):void
Sends a request to the gateway to unsubscribe from a list of services.
Connector
Events
 Event Summary Defined By
  Dispatched when a response to an action list request is received.Connector
  Dispatched when a response to set AOI request is received.Connector
  Dispatched when a response to an authentication request is received.Connector
  Dispatched when auxiliary data is received.Connector
  Dispatched when a response to a connection request is received.Connector
  Dispatched when a response to a disconnect request is received.Connector
  Dispatched when gateway monitoring data is received.Connector
  Dispatched when a general error occurs.Connector
  Dispatched when an observation is received.Connector
  Dispatched when a response to a request for service definitions is received.Connector
  Dispatched when a response a subscribe request is received.Connector
  Dispatched when a response symbol request is received.Connector
  Dispatched when a response to an unsubscribe request is received.Connector
Property Detail
isConnectedproperty
isConnected:Boolean  [read-only]

Indicates whether the socket connection is open or not.


Implementation
    public function get isConnected():Boolean
isLoggedInproperty 
isLoggedIn:Boolean  [read-only]

Indicates whether or not currently logged in to the Tracking Server.


Implementation
    public function get isLoggedIn():Boolean
messageFormatManagerproperty 
messageFormatManager:MessageFormatManager  [read-only]

Gets most recent MessageFormatManager returned by the Tracking Server.


Implementation
    public function get messageFormatManager():MessageFormatManager
passwordproperty 
password:String  [read-only]

Gets most recent password used to log in.


Implementation
    public function get password():String
portproperty 
port:int  [read-only]

Gets most recent port number used to connect.


Implementation
    public function get port():int
remoteHostnameproperty 
remoteHostname:String  [read-only]

Gets most recent hostname used to connect.


Implementation
    public function get remoteHostname():String
usernameproperty 
username:String  [read-only]

Gets username used to log in.


Implementation
    public function get username():String
Constructor Detail
Connector()Constructor
public function Connector()

The constructor.

Method Detail
authenticateAsync()method
public function authenticateAsync(username:String, password:String):void

Authenticates with the Tracking Server using the provided username and password. Listen to authenticateResponse event to detect completion or error.

Parameters

username:String — Username for authentication.
 
password:String — Password for authentication.

See also

connectAsync()method 
public function connectAsync(remoteHostname:String, port:int):void

Connects asynchronously to given remoteHostname at given port. Listen to connectResponse event to detect completion or error.

Parameters

remoteHostname:String — Hostname of the Tracking Server Gateway.
 
port:int — Port number of the Tracking Server Gateway.

See also

disconnectAsync()method 
public function disconnectAsync(preserveSession:Boolean):void

Disconnects connection and closes socket to gateway. Listen to disconnectResponse event to detect completion or error.

Parameters

preserveSession:Boolean — Specifies whether or not to preserve the gateway session.

See also

getActionListAsync()method 
public function getActionListAsync():void

Sends a request to the Tracking Server for available actions. Listen to actionListResponse event to detect completion or error.

See also

getAuxiliaryDataAsync()method 
public function getAuxiliaryDataAsync(serviceName:String):void

Sends a request to the Tracking Server for the auxiliary data of a complex service. Listen to auxiliaryDataReceived event to detect received data.

Parameters

serviceName:String — Name of complex service.

See also

getGatewayStatisticsAsync()method 
public function getGatewayStatisticsAsync(array:Array):void

Parameters

array:Array

getServiceDefinitionsAsync()method 
public function getServiceDefinitionsAsync():void

Sends a request to the Tracking Server for service definitions available to the current user. Listen to serviceDefinitionsResponse event to detect completion or error.

See also

getServiceNames()method 
public function getServiceNames():Array

Gets most recent list of services available.

Returns
Array — Array of service names
getSubscribedServiceNames()method 
public function getSubscribedServiceNames():Array

Gets the list of subscribed services.

Returns
Array — Array of subscribed service names
getSymbolFromIDAsync()method 
public function getSymbolFromIDAsync(symbolId:String, imgSize:int, isMOLESymbol:Boolean):void

Sends a request to the Tracking Server for a symbol. If requesting a MOLE symbol, MOLE must be installed on the Tracking Server. Currently only MOLE symbols are supported. Listen to symbolResponse to detect completion or error.

Parameters

symbolId:String — Indicates text id of the symbol.
 
imgSize:int — Indicates the length of one side of the symbol.
 
isMOLESymbol:Boolean — Specifies whether requested symbol is a MOLE symbol or not.

See also

getSymbolFromXMLAsync()method 
public function getSymbolFromXMLAsync(xmlRequest:String, isMOLESymbol:Boolean):void

Sends a request to the Tracking Server for a symbol. If requesting a MOLE symbol, MOLE must be installed on the Tracking Server. Currently only MOLE symbols are supported. Listen to symbolResponse to detect completion or error.

Parameters

xmlRequest:String — XML string containing request.
 
isMOLESymbol:Boolean — Specifies whether requested symbol is a MOLE symbol or not.

See also

getUnsubscribedServiceNames()method 
public function getUnsubscribedServiceNames():Array

Gets the list of unsubscribed services.

Returns
Array — Array of unsubscribed service names
setAOIForServiceAsync()method 
public function setAOIForServiceAsync(serviceName:String, aoiEnvelope:TmsEnvelope, aoiType:SetAOIType):Boolean

Publishes a message to other clients connected to the gateway, including the client publishing the message. Listen to observationReceived event to detect received message.

Parameters

serviceName:String — Message to be published
 
aoiEnvelope:TmsEnvelope — Service name of the message
 
aoiType:SetAOIType

Returns
Boolean

See also

subscribeToServiceAsync()method 
public function subscribeToServiceAsync(serviceName:String):void

Sends a request to the gateway to subscribe to a single service. Listen to subscribeResponse event to detect completion or error.

Parameters

serviceName:String — Name of service to subscribe to

See also

subscribeToServiceListAsync()method 
public function subscribeToServiceListAsync(subscribeServiceNames:Array):void

Sends a request to the gateway to subscribe to a list of services. Listen to subscribeResponse event to detect completion or error.

Parameters

subscribeServiceNames:Array — Array of service names to subscribe to

See also

unsubscribeFromServiceAsync()method 
public function unsubscribeFromServiceAsync(serviceName:String):void

Sends a request to the gateway to unsubscribe from a single service. Listen to unsubscribeResponse event to detect completion or error.

Parameters

serviceName:String — Name of service to unsubscribe from

See also

unsubscribeFromServiceListAsync()method 
public function unsubscribeFromServiceListAsync(unsubscribeServiceNames:Array):void

Sends a request to the gateway to unsubscribe from a list of services. Listen to unsubscribeResponse event to detect completion or error.

Parameters

unsubscribeServiceNames:Array — Array of service names to unsubscribe from

See also

Event Detail
actionListResponse Event
Event Object Type: com.esri.tracking.connector.events.ActionListEvent
ActionListEvent.type property = com.esri.tracking.connector.events.ActionListEvent.ACTION_LIST_RESPONSE

Dispatched when a response to an action list request is received.

Defines the value of the type property of an actionListResponse event.
aoiResponse Event  
Event Object Type: com.esri.tracking.connector.events.SetAOIEvent
SetAOIEvent.type property = com.esri.tracking.connector.events.AOIEvent.AOI_RESPONSE

Dispatched when a response to set AOI request is received.

authenticateResponse Event  
Event Object Type: com.esri.tracking.connector.events.AuthenticateEvent
AuthenticateEvent.type property = com.esri.tracking.connector.events.AuthenticateEvent.AUTHENTICATE_RESPONSE

Dispatched when a response to an authentication request is received.

Defines the value of the type property of an authenticateResponse event.
auxiliaryDataReceived Event  
Event Object Type: com.esri.tracking.connector.events.AuxiliaryDataEvent
AuxiliaryDataEvent.type property = com.esri.tracking.connector.events.AuxiliaryDataEvent.AUXILIARY_DATA_RECEIVED

Dispatched when auxiliary data is received.

Defines the value of the type property of an auxiliaryDataReceived event.
connectResponse Event  
Event Object Type: com.esri.tracking.connector.events.ConnectEvent
ConnectEvent.type property = com.esri.tracking.connector.events.ConnectEvent.CONNECT_RESPONSE

Dispatched when a response to a connection request is received.

Defines the value of the type property of an connectResponse event.
disconnectResponse Event  
Event Object Type: com.esri.tracking.connector.events.DisconnectEvent
DisconnectEvent.type property = com.esri.tracking.connector.events.DisconnectEvent.DISCONNECT_RESPONSE

Dispatched when a response to a disconnect request is received.

Defines the value of the type property of an disconnectResponse event.
gatewayDataReceived Event  
Event Object Type: com.esri.tracking.connector.events.GatewayDataEvent
GatewayDataEvent.type property = com.esri.tracking.connector.events.GatewayDataEvent.GATEWAY_DATA_RECEIVED

Dispatched when gateway monitoring data is received.

Defines the value of the type property of an gatewayDataReceived event.
generalError Event  
Event Object Type: com.esri.tracking.connector.events.GeneralErrorEvent
GeneralErrorEvent.type property = com.esri.tracking.connector.events.GeneralErrorEvent.GENERAL_ERROR

Dispatched when a general error occurs. This error could be caused due to a number of different reasons and can occur at any time. It is recommended to place an event listener early in the client code to catch these types of errors.

Defines the value of the type property of an generalError event.
observationReceived Event  
Event Object Type: com.esri.tracking.connector.events.ObservationEvent
ObservationEvent.type property = com.esri.tracking.connector.events.ObservationEvent.OBSERVATION_RECEIVED

Dispatched when an observation is received.

Defines the value of the type property of an observationReceived event.
serviceDefinitionsResponse Event  
Event Object Type: com.esri.tracking.connector.events.ServiceDefinitionsEvent
ServiceDefinitionsEvent.type property = com.esri.tracking.connector.events.ServiceDefinitionsEvent.SERVICE_DEFINITIONS_RESPONSE

Dispatched when a response to a request for service definitions is received.

Defines the value of the type property of an serviceDefinitionsResponse event.
subscribeResponse Event  
Event Object Type: com.esri.tracking.connector.events.SubscribeEvent
SubscribeEvent.type property = com.esri.tracking.connector.events.SubscribeEvent.SUBSCRIBE_RESPONSE

Dispatched when a response a subscribe request is received.

Defines the value of the type property of an subscribeResponse event.
symbolResponse Event  
Event Object Type: com.esri.tracking.connector.events.SymbolEvent
SymbolEvent.type property = com.esri.tracking.connector.events.SymbolEvent.SYMBOL_RESPONSE

Dispatched when a response symbol request is received.

Defines the value of the type property of an symbolResponse event.
unsubscribeResponse Event  
Event Object Type: com.esri.tracking.connector.events.UnsubscribeEvent
UnsubscribeEvent.type property = com.esri.tracking.connector.events.UnsubscribeEvent.UNSUBSCRIBE_RESPONSE

Dispatched when a response to an unsubscribe request is received.

Defines the value of the type property of an unsubscribeResponse event.
Examples
This example shows how to establish a connection, authenticate and get a list of services.
     
     private var connector:Connector = new Connector();
     
     private function start():void
     {
          connector.addEventListener(ConnectEvent.CONNECT_RESPONSE, connector_connectResponse);
          connector.connectAsync("servername", 5506);
     }
     
     private function connector_connectResponse(evt:ConnectEvent):void
     {
       if (evt.succeeded == true)
       {
            connector.addEventListener(AuthenticateEvent.AUTHENTICATE_RESPONSE, connector_authenticateResponse);
            connector.authenticateAsync("username", "password");
       }
       else
       {
            Alert.show(evt.errorMessage, "Connection Error");
       }
     }
     
     private function connector_authenticateResponse(evt:AuthenticateEvent):void
     {
       if (evt.succeeded == true)
      {
        connector.addEventListener(ServiceDefinitionsEvent.SERVICE_DEFINITIONS_RESPONSE, connector_serviceDefinitionsResponse);
        connector.getServiceDefinitionsAsync();
      }
      else
      {
        Alert.show(evt.errorMessage, "Authentication Error");
      }
     }
     
     private function connector_serviceDefinitionsResponse(evt:ServiceDefinitionsEvent):void
     {
       if (evt.succeeded == true)
       {
         // Do something with services received.
      }
      else
      {
        Alert.show(evt.errorMessage, "Service Definitions Error");
      }
     }