com.skype.tutorial.util
Class MySession

java.lang.Object
  extended by com.skype.tutorial.util.MySession

public class MySession
extends java.lang.Object

Tutorial Session Object. Encapsulates common aspects of the SkypeKit-based Java tutorials. These include:

Since:
1.0
Author:
Andrea Drane (ported/refactored from existing C++ tutorial code)

Field Summary
 boolean callFinished
          Whether our call has finished.
static java.lang.String IP_ADDR
          Server IP Address.
 com.skype.api.Account myAccount
          Account instance for this tutorial session.
 java.lang.String myAccountName
          Name of the target Skype account, which is actually the Skype Name of the user that created it.
static java.io.PrintStream myConsole
          Console PrintStream.
 JavaTutorialListeners myJavaTutorialListeners
          Callbacks/event handlers for this tutorial session.
 ParseSkypeKitVersion myParseSkypeKitVersion
          SkypeKit version number parse instance for this tutorial session.
 SignInMgr mySignInMgr
           
 MySkype mySkype
          Skype instance for this tutorial session.
 com.skype.ipc.TCPSocketTransport myTransport
           
 java.lang.String myTutorialTag
          Info/Debug console output message prefix/identifier tag.
static int PORT_NUM
          Server Port.
static java.lang.String T_TAG_DFLT
          Default value for the Info/Debug console output message prefix/identifier tag, in case we get passed a null or empty string.
 
Constructor Summary
MySession()
           
 
Method Summary
 boolean doCreateSession(java.lang.String tutorialTag, java.lang.String accountName, AppToken myAppToken)
          Creates most everything needed for a tutorial session; the Account instance is populated during sign-in.
 void doTearDownSession()
          Tears down a tutorial session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

T_TAG_DFLT

public static final java.lang.String T_TAG_DFLT
Default value for the Info/Debug console output message prefix/identifier tag, in case we get passed a null or empty string.

Since:
1.0
See Also:
Constant Field Values

myTutorialTag

public java.lang.String myTutorialTag
Info/Debug console output message prefix/identifier tag. Corresponds to the tutorial's class name.

Since:
1.0

myConsole

public static java.io.PrintStream myConsole
Console PrintStream.

Based off System.out, but specifies autoFlush as true to ensure that console output does not intermingle since both the tutorial code and the event handlers write to the console.

Since:
1.0

myAccountName

public java.lang.String myAccountName
Name of the target Skype account, which is actually the Skype Name of the user that created it.

Since:
1.0

mySignInMgr

public SignInMgr mySignInMgr

mySkype

public MySkype mySkype
Skype instance for this tutorial session.

Since:
1.0
See Also:
MySkype, Skype

myParseSkypeKitVersion

public ParseSkypeKitVersion myParseSkypeKitVersion
SkypeKit version number parse instance for this tutorial session.

Do not attempt to populate this instance until after intializing mySkype!

Since:
1.0
See Also:
ParseSkypeKitVersion

myAccount

public com.skype.api.Account myAccount
Account instance for this tutorial session. Set on successful login, not during session creation!

Since:
1.0
See Also:
Account

callFinished

public boolean callFinished
Whether our call has finished.

Initialized to false at start of call; set to true by Participant onChange handler.

Since:
1.0
See Also:
Account

myJavaTutorialListeners

public JavaTutorialListeners myJavaTutorialListeners
Callbacks/event handlers for this tutorial session.

Since:
1.0

IP_ADDR

public static final java.lang.String IP_ADDR
Server IP Address.

Since:
1.0
See Also:
Constant Field Values

PORT_NUM

public static final int PORT_NUM
Server Port.

You will need to start the matching SkypeKit runtime with option:     -p 9999 where -p 9999 reflects this value.

Since:
1.0
See Also:
Constant Field Values

myTransport

public com.skype.ipc.TCPSocketTransport myTransport
Constructor Detail

MySession

public MySession()
Method Detail

doCreateSession

public boolean doCreateSession(java.lang.String tutorialTag,
                               java.lang.String accountName,
                               AppToken myAppToken)
Creates most everything needed for a tutorial session; the Account instance is populated during sign-in.

Parameters:
tutorialTag - The tutorial's class name. If null or the empty string, default it to T_TAG_DFLT.
accountName - The name of the account to use for this tutorial. If null or the empty string, fail by throwing a RuntimeException indicating that fact.
myAppToken - AppToken string for this tutorial.
Returns:
  • true: session initialized
  • false: session initialization failed due to:
    • no or empty account name
    • com.skype.api.Skype.Init failed
    • could not obtain an Account instance
Since:
1.0
See Also:
SignInMgr

doTearDownSession

public void doTearDownSession()
Tears down a tutorial session.

Specifically, this involves:
  1. Un-registering the listeners
  2. Disconnecting the transport
  3. "Closing" our Skype instance, which terminates the SkypeKit runtime
    1. Since:
      1.0
      See Also:
      JavaTutorialListeners.unRegisterAllListeners(), TCPSocketTransport.disconnect(), Skype.Close()