com.incesoft.botplatform.sdk
Interface RobotSession

All Known Implementing Classes:
DefaultRobotSession

public interface RobotSession

A session between robot and user. When user opens a conversation window or reconnect after session timeout, a session starts. During the session, SP can send message to user. When users close a conversation window or session timeout, a session ends and SP cannot send any messages.

Author:
LiBo

Field Summary
static int OPEN_MODE_CONV_OPEN
          A flag indicates that a new conversation started by user.
static int OPEN_MODE_ROBOT
          A flag indicates that a new conversation started by robot.
static int OPEN_MODE_TIMEOUT
          A flag indicates that a new conversation started by reconnecting after session timeout.
static int OPEN_MODE_UNKONW
          A flag indicates that a new conversation started by unkonw reason.
 
Method Summary
 void close()
          Close this session.
 RobotMessage createMessage()
          Create a message
 java.lang.Object getAttribute(java.lang.String name)
          Returns the object bound with the specified name in this session, or null if no object is bound under the name.
 java.util.Iterator<java.lang.String> getAttributeNames()
          Returns an Iterator of String objects containing the names of all the objects bound to this session
 int getOpenMode()
          Get the open mode of session
 java.lang.String getRobot()
          Get the robot account(MSN Passport) associated with this session
 RobotUser getUser()
          Get a user's reference in session
 RobotUser getUser(java.lang.String userid)
          Get a user's reference in session
 java.util.Collection<RobotUser> getUsers()
          Get a users' collection in session
 void inviteUser(java.lang.String user)
          Invite a user into the current conversation.
 boolean isActivityOpened()
          Check whether the activity window opened.
 boolean isClosed()
          Check whether the session is closed.
 java.lang.Object removeAttribute(java.lang.String name)
          Removes the object bound with the specified name from this session.
 void send(RobotMessage message)
          Send RobotMessage
 void send(java.lang.String message)
          Send plain text message
 void sendActivity(int appid, java.lang.String appname, java.lang.String data)
          Send activity data to the MSN Activity window.
 void sendActivity(java.lang.String data)
          Show the content of network resource in MSN Activity window
 void sendActivity(java.lang.String data, java.lang.String friendlyName)
          Show the content of network resource in MSN Activity window
 void sendFile(java.lang.String uri)
          Send a file
 void sendFile(java.lang.String uri, java.lang.String friendlyName)
          Send a file
 void sendFileAcceptance(java.lang.String transferId, java.lang.String saveUrl)
          Accept a file transfer request, and a url should be specified for saving the file data.
 void sendFileCancellation(java.lang.String transferId)
          Cancel a file transfer.
 void sendFileRejection(java.lang.String transferId)
          Reject a file transfer request.
 void sendInk(byte[] inkData)
          Send a ink message
 void sendNudge()
          Send nudge
 void sendTyping()
          Send a typing infomation which will be presented on the bottom of the conversation panel
 void sendVoiceclip(java.lang.String uri)
          Send a voice clip
 void sendWebcam(java.lang.String serverIP, int serverPort, int recipientid, int sessionid)
          Send webcam Once the connection is established, the client that connected to the other peer should authenticate himself with sending the message (no header, no nothing) : "recipientid=X&sessionid=Y\r\n\r\n" The other peer should then send (if correctly authenticated) the message "connected\r\n\r\n" The connecting peer should also send "connected\r\n\r\n" From this point the connection is done and The connecting peer is authenticated Subsequently, the server may send the encoded data of the webcam in mimic format
 void sendWink(java.lang.String uri)
          Send a msn default wink
 void sendWink(java.lang.String uri, java.lang.String stamp)
          Send a customized wink
 void setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object to this session, using the name specified.
 

Field Detail

OPEN_MODE_UNKONW

static final int OPEN_MODE_UNKONW
A flag indicates that a new conversation started by unkonw reason.

See Also:
Constant Field Values

OPEN_MODE_CONV_OPEN

static final int OPEN_MODE_CONV_OPEN
A flag indicates that a new conversation started by user.

See Also:
Constant Field Values

OPEN_MODE_TIMEOUT

static final int OPEN_MODE_TIMEOUT
A flag indicates that a new conversation started by reconnecting after session timeout.

See Also:
Constant Field Values

OPEN_MODE_ROBOT

static final int OPEN_MODE_ROBOT
A flag indicates that a new conversation started by robot.

See Also:
Constant Field Values
Method Detail

send

void send(java.lang.String message)
          throws RobotException
Send plain text message

Parameters:
message -
Throws:
RobotException

send

void send(RobotMessage message)
          throws RobotException
Send RobotMessage

Parameters:
message - RobotMessage
Throws:
RobotException

sendNudge

void sendNudge()
               throws RobotException
Send nudge

Throws:
RobotException

sendActivity

void sendActivity(java.lang.String data)
                  throws RobotException
Show the content of network resource in MSN Activity window

Parameters:
data - network resource to be shown (generally are webpages or pictures)
Throws:
RobotException

sendActivity

void sendActivity(java.lang.String data,
                  java.lang.String friendlyName)
                  throws RobotException
Show the content of network resource in MSN Activity window

Parameters:
data - network resource to be shown (generally are webpages or pictures)
friendlyName - friendly name which represents the network resource in the activity invitation
Throws:
RobotException

sendActivity

void sendActivity(int appid,
                  java.lang.String appname,
                  java.lang.String data)
                  throws RobotException
Send activity data to the MSN Activity window.

Parameters:
appid - id of the MSN Activity
appname - name of the MSN Activity
data - network resource to be shown (generally are webpages or pictures)
Throws:
RobotException

isActivityOpened

boolean isActivityOpened()
Check whether the activity window opened.


sendTyping

void sendTyping()
                throws RobotException
Send a typing infomation which will be presented on the bottom of the conversation panel

Throws:
RobotException

createMessage

RobotMessage createMessage()
Create a message

Returns:
RobotMessage RobotMessage

getUser

RobotUser getUser()
Get a user's reference in session

Returns:
RobotUser RobotUser

getUser

RobotUser getUser(java.lang.String userid)
Get a user's reference in session

Parameters:
userid - user id
Returns:
RobotUser RobotUser

getUsers

java.util.Collection<RobotUser> getUsers()
Get a users' collection in session

Returns:
Collection

getRobot

java.lang.String getRobot()
Get the robot account(MSN Passport) associated with this session

Returns:
robot account.

getOpenMode

int getOpenMode()
Get the open mode of session

Returns:
openmode. 0 - Unknown; 1 - Indicates that user opens a conversation window; 2 - Indicates that session timeout and then reconnects

isClosed

boolean isClosed()
Check whether the session is closed. If session is closed, you cannot send any messages.


close

void close()
           throws RobotException
Close this session.

Throws:
RobotException

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value)
Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound

getAttribute

java.lang.Object getAttribute(java.lang.String name)
Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Parameters:
name - a string specifying the name of the object
Returns:
the object with the specified name

removeAttribute

java.lang.Object removeAttribute(java.lang.String name)
Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

Parameters:
name - the name of the object to remove from this session
Returns:
the object with the specified name

getAttributeNames

java.util.Iterator<java.lang.String> getAttributeNames()
Returns an Iterator of String objects containing the names of all the objects bound to this session

Returns:
an Iterator of String objects specifying the names of all the objects bound to this session

inviteUser

void inviteUser(java.lang.String user)
                throws RobotException
Invite a user into the current conversation.

Parameters:
user -
Throws:
RobotException

sendFile

void sendFile(java.lang.String uri)
              throws RobotException
Send a file

Parameters:
uri - unique name of the resource pre-uploaded to BOTPLATFORM and verified by BOTPLATFORM
Throws:
RobotException

sendFile

void sendFile(java.lang.String uri,
              java.lang.String friendlyName)
              throws RobotException
Send a file

Parameters:
uri - unique name of the resource pre-uploaded to BOTPLATFORM and verified by BOTPLATFORM
friendlyName - friendly name which represents the file in the file transfer invitation
Throws:
RobotException

sendFileAcceptance

void sendFileAcceptance(java.lang.String transferId,
                        java.lang.String saveUrl)
                        throws RobotException
Accept a file transfer request, and a url should be specified for saving the file data.

Parameters:
transferId - id of the current file transfer.
saveUrl - a url to receive a HTTP POST request to get the data of the file.
Throws:
RobotException

sendFileRejection

void sendFileRejection(java.lang.String transferId)
                       throws RobotException
Reject a file transfer request.

Parameters:
transferId - id of the current file transfer.
Throws:
RobotException

sendFileCancellation

void sendFileCancellation(java.lang.String transferId)
                          throws RobotException
Cancel a file transfer.

Parameters:
transferId -
Throws:
RobotException

sendInk

void sendInk(byte[] inkData)
             throws RobotException
Send a ink message

Parameters:
inkData - data of the ink message.
Throws:
RobotException

sendWink

void sendWink(java.lang.String uri)
              throws RobotException
Send a msn default wink

Parameters:
uri - unique name of the resource pre-uploaded to BOTPLATFORM and verified by BOTPLATFORM
Throws:
RobotException

sendWink

void sendWink(java.lang.String uri,
              java.lang.String stamp)
              throws RobotException
Send a customized wink

Parameters:
uri - unique name of the resource pre-uploaded to BOTPLATFORM and verified by BOTPLATFORM
stamp - base64 encoded signature of the file.It is a S/MIME signature of the Base64 encoded hash of the Content cabinet file and is signed by the MSN Content Authority.
Throws:
RobotException

sendVoiceclip

void sendVoiceclip(java.lang.String uri)
                   throws RobotException
Send a voice clip

Parameters:
uri - unique name of the resource pre-uploaded to BOTPLATFORM and verified by BOTPLATFORM
Throws:
RobotException

sendWebcam

void sendWebcam(java.lang.String serverIP,
                int serverPort,
                int recipientid,
                int sessionid)
                throws RobotException
Send webcam Once the connection is established, the client that connected to the other peer should authenticate himself with sending the message (no header, no nothing) : "recipientid=X&sessionid=Y\r\n\r\n" The other peer should then send (if correctly authenticated) the message "connected\r\n\r\n" The connecting peer should also send "connected\r\n\r\n" From this point the connection is done and The connecting peer is authenticated Subsequently, the server may send the encoded data of the webcam in mimic format

Parameters:
serverIP - webcam resource server IP address
serverPort - webcam resource server port
recipientid - the authentication info, should be between 100 and 199
sessionid - the authentication info, should be between 9000 and 9999
Throws:
RobotException