|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSCCT.JavaSubscriber.SCCT_Subject
public class SCCT_Subject
It is a fundamental class of this library.
It has the task of handling the communication with the publisher,
provides some methods to manage the connection and to send packages,
and provides received data to registered Observer objects.
Constructor Summary | |
---|---|
SCCT_Subject()
|
Method Summary | |
---|---|
int |
clearSelectedSourceList()
The SCCT_Subject object won't listen to any data sources list. |
int |
closeCommunication()
Sends to the publisher the request to close the communication. |
int |
getAwaitingPackages()
Returns the number of packages awaiting in the sending queue. |
static SCCT_Subject |
getInstance()
This static method returns unique instance of SCCT_Subject (see Singleton pattern). |
int |
getLastPackageSent()
Returns the packageNumber id of the last sent package. |
java.lang.String |
getSubscriberDescription()
Returns the description used in the openCommunication method. |
int |
getTimeout()
Returns the timeout used in the openCommunication method. |
boolean |
isConnected()
Returns true value if it's connected, false if it doesn't. |
boolean |
isSourceFilterEnabled()
Returns the sourceFilterEnabled flag used in the openCommunication method. |
void |
openCommunication(java.lang.String address,
int port,
java.lang.String APIKey)
This function use as description, timeout and sourceFilterEnabled flag three properties. |
void |
openCommunication(java.lang.String address,
int port,
java.lang.String APIKey,
java.lang.String description)
Sets the timeout to default value and the source filter to false. |
void |
openCommunication(java.lang.String address,
int port,
java.lang.String APIKey,
java.lang.String description,
boolean sourceFilterEnabled)
Sets the timeout to default value. |
void |
openCommunication(java.lang.String address,
int port,
java.lang.String APIKey,
java.lang.String description,
int timeout)
Set the source filter to false. |
void |
openCommunication(java.lang.String address,
int port,
java.lang.String APIKey,
java.lang.String description,
int timeout,
boolean sourceFilterEnabled)
This method is very important because allows to open the communication with the publisher. |
void |
registerObserver(SCCT_Observer o)
This method allows an observer to register itself in a list of observers for data receiving. |
int |
sendArray(SCCT_2DArrayPackage arrayPackage)
Sends a SCCT_2DArrayPackage subclass to the publisher. |
int |
sendFile(SCCT_FilePackage fp)
Sends a file to the publisher. |
int |
sendFilter(SCCT_Filter filter)
Sends a SCCT_Filter subclass to the publisher. |
int |
sendImage(SCCT_ImagePackage ip)
Sends an image to the publisher. |
int |
sendLocation(SCCT_LocationPackage lp)
Sends a SCCT_LocationPackage to the publisher. |
int |
sendMessage(SCCT_MessagePackage messagePackage)
Sends a custom message to the publisher. |
int |
sendMessage(java.lang.String message,
int code)
Sends a custom message to the publisher. |
int |
sendXml(SCCT_XmlPackage xmlPackage)
Sends a custom xml to the publisher. |
int |
sendXml(java.lang.String xml)
Sends a custom xml to the publisher. |
int |
setSelectedSourceList(java.util.ArrayList<java.lang.Integer> list)
Sets a data sources list on which the SCCT_Subject object will listen. |
int |
setSelectedSourceList(int source)
Set a single source of data on witch the SCCT_Subject object will listen. |
void |
setSourceFilterEnabled(boolean sourceFilterEnabled)
Specifies whether the source filter is or is not enabled. |
void |
setSubscriberDescription(java.lang.String subscriberDescription)
Sets the description to send the publisher in the openCommunication method. |
void |
setTimeout(int timeout)
Sets the timeout in seconds to use in the openCommunication method. |
int |
start()
Sends to the publisher the request to start data transmission. |
int |
stop()
Sends to the publisher the request to stop data transmission. |
void |
unregisterObserver(SCCT_Observer o)
This method allows to unregister an observer in a list of registered observers. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SCCT_Subject()
Method Detail |
---|
public static SCCT_Subject getInstance()
public void registerObserver(SCCT_Observer o)
o
- It is the observer to register.public void unregisterObserver(SCCT_Observer o)
o
- It is the observer to unregister.public java.lang.String getSubscriberDescription()
public void setSubscriberDescription(java.lang.String subscriberDescription)
subscriberDescription
- The description that identify the subscriber.public int getTimeout()
public void setTimeout(int timeout)
timeout
- public boolean isSourceFilterEnabled()
public void setSourceFilterEnabled(boolean sourceFilterEnabled)
sourceFilterEnabled
- public int getLastPackageSent()
public int getAwaitingPackages()
public void openCommunication(java.lang.String address, int port, java.lang.String APIKey, java.lang.String description, int timeout, boolean sourceFilterEnabled) throws java.io.IOException
address
- The IP address or the name of the publisher.port
- The port number.APIKey
- The password for authenticate the client.description
- The description or the name of the client.timeout
- The timeout value in seconds. If the connectionHandler is lost
and the timeout expired the library closes the communication and sends a
timeout expired error to observers. This value must be bigger than one.sourceFilterEnabled
- Enables or disables the source filter.
java.io.IOException
- If you insert a wrong parameter or if the library
can't establish a connectionHandler with publisher.*This method is available only in PRO version.*
public void openCommunication(java.lang.String address, int port, java.lang.String APIKey, java.lang.String description, boolean sourceFilterEnabled) throws java.io.IOException
java.io.IOException
openCommunication(String, int, String, String, int, boolean)
public void openCommunication(java.lang.String address, int port, java.lang.String APIKey, java.lang.String description) throws java.io.IOException
java.io.IOException
openCommunication(String, int, String, String, int, boolean)
public void openCommunication(java.lang.String address, int port, java.lang.String APIKey, java.lang.String description, int timeout) throws java.io.IOException
java.io.IOException
openCommunication(String, int, String, String, int, boolean)
public void openCommunication(java.lang.String address, int port, java.lang.String APIKey) throws java.io.IOException
address
- The IP address or the name of the publisher.port
- The port number.APIKey
- The password for authenticate the client.
java.io.IOException
- If you insert a wrong parameter or if the library
can't establish a connectionHandler with publisher.getSubscriberDescription()
,
getTimeout()
,
isSourceFilterEnabled()
,
openCommunication(java.lang.String, int, java.lang.String, java.lang.String, int, boolean)
public int setSelectedSourceList(java.util.ArrayList<java.lang.Integer> list)
list
- An ArrayList of integers that contains the numbers id of chosen sources.
public int setSelectedSourceList(int source)
source
- The number id of chosen source.
setSelectedSourceList(ArrayList)
public int clearSelectedSourceList()
public int start()
public int stop()
public int sendMessage(java.lang.String message, int code)
message
- The description of the message.code
- The code of the message.
public int sendMessage(SCCT_MessagePackage messagePackage)
messagePackage
- The SCCT_MessagePackage object to send.
public int sendXml(java.lang.String xml)
xml
- The custom xml to send.
public int sendXml(SCCT_XmlPackage xmlPackage)
xmlPackage
- The SCCT_XmlPackage to send.
public int closeCommunication()
public boolean isConnected()
public int sendFile(SCCT_FilePackage fp)
fp
- The object containing the file to send.
SCCT_FilePackage
public int sendImage(SCCT_ImagePackage ip)
ip
- The object containing the image to send.
SCCT_ImagePackage
public int sendLocation(SCCT_LocationPackage lp)
lp
- The SCCT_LocationPackage to send.
SCCT_LocationPackage
public int sendArray(SCCT_2DArrayPackage arrayPackage)
arrayPackage
- the array to send.
SCCT_2DArrayPackage
public int sendFilter(SCCT_Filter filter)
filter
- the filter to send to publisher.
SCCT_Filter
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |