org.ccnx.android.ccnlib.CCNxServiceControl Class Reference

This is a helper class to access the ccnd and repo services. More...

List of all members.

Public Member Functions

 CCNxServiceControl (Context ctx)
void registerCallback (CCNxServiceCallback cb)
void unregisterCallback ()
boolean startAll ()
 Start the CCN daemon and Repo If configuration parameters have been set these will be used This is a BLOCKING call.
void startAllInBackground ()
 Start the CCN daemon and Repo If configuration parameters have been set these will be used This is a non-blocking call.
void connect ()
void disconnect ()
 Disconnect from the services.
void stoptAll ()
 Stop the CCN daemon and Repo This call will unbind from the service and stop it.
boolean isCcndRunning ()
boolean isRepoRunning ()
void startCcnd ()
void stopCcnd ()
void startRepo ()
void stopRepo ()
void newCCNxAPIStatus (SERVICE_STATUS s)
void setCcndOption (CCND_OPTIONS option, String value)
void setRepoOption (REPO_OPTIONS option, String value)
boolean allReady ()
 Are ccnd and the repo running and ready?
SERVICE_STATUS getCcndStatus ()
SERVICE_STATUS getRepoStatus ()

Package Attributes

CcndWrapper ccndInterface
RepoWrapper repoInterface
Context _ctx
CCNxServiceCallback _cb = null
SERVICE_STATUS ccndStatus = SERVICE_STATUS.SERVICE_OFF
SERVICE_STATUS repoStatus = SERVICE_STATUS.SERVICE_OFF
CCNxServiceCallback ccndCallback
CCNxServiceCallback repoCallback

Detailed Description

This is a helper class to access the ccnd and repo services.

It provides abstractions so that the programs can start and stop the services as well as interact with them for configuration and monitoring.


Member Function Documentation

boolean org.ccnx.android.ccnlib.CCNxServiceControl.allReady (  ) 

Are ccnd and the repo running and ready?

Returns:
true if BOTH ccnd and the repo are in state Running
void org.ccnx.android.ccnlib.CCNxServiceControl.disconnect (  ) 

Disconnect from the services.

This is needed for a clean exit from an application. It leaves the services running.

boolean org.ccnx.android.ccnlib.CCNxServiceControl.startAll (  ) 

Start the CCN daemon and Repo If configuration parameters have been set these will be used This is a BLOCKING call.

Returns:
true if everything started correctly, false otherwise
void org.ccnx.android.ccnlib.CCNxServiceControl.startAllInBackground (  ) 

Start the CCN daemon and Repo If configuration parameters have been set these will be used This is a non-blocking call.

If you want to be notified when everything has started then you should register a callback before issuing this call.

void org.ccnx.android.ccnlib.CCNxServiceControl.stoptAll (  ) 

Stop the CCN daemon and Repo This call will unbind from the service and stop it.

There is no need to issue a disconnect().


Member Data Documentation

CCNxServiceCallback org.ccnx.android.ccnlib.CCNxServiceControl.ccndCallback [package]
Initial value:
 new CCNxServiceCallback(){
                @Override
                public void newCCNxStatus(SERVICE_STATUS st) {
                        Log.i(TAG,"ccndCallback ccndStatus = " + st.toString());
                        ccndStatus = st;
                        switch(ccndStatus){
                        case SERVICE_OFF:
                                newCCNxAPIStatus(SERVICE_STATUS.CCND_OFF);
                                break;
                        case SERVICE_INITIALIZING:
                                newCCNxAPIStatus(SERVICE_STATUS.CCND_INITIALIZING);
                                break;
                        case SERVICE_TEARING_DOWN:
                                newCCNxAPIStatus(SERVICE_STATUS.CCND_TEARING_DOWN);
                                break;
                        case SERVICE_RUNNING:
                                newCCNxAPIStatus(SERVICE_STATUS.CCND_RUNNING);
                                break;
                        }
                }
        }
CCNxServiceCallback org.ccnx.android.ccnlib.CCNxServiceControl.repoCallback [package]
Initial value:
 new CCNxServiceCallback(){
                @Override
                public void newCCNxStatus(SERVICE_STATUS st) {
                        Log.i(TAG,"repoCallback repoStatus = " + st.toString());
                        repoStatus = st;        
                        switch(repoStatus){
                        case SERVICE_OFF:
                                newCCNxAPIStatus(SERVICE_STATUS.REPO_OFF);
                                break;
                        case SERVICE_INITIALIZING:
                                newCCNxAPIStatus(SERVICE_STATUS.REPO_INITIALIZING);
                                break;
                        case SERVICE_TEARING_DOWN:
                                newCCNxAPIStatus(SERVICE_STATUS.REPO_TEARING_DOWN);
                                break;
                        case SERVICE_RUNNING:
                                newCCNxAPIStatus(SERVICE_STATUS.REPO_RUNNING);
                                break;
                        }
                }
        }

The documentation for this class was generated from the following file:
Generated on Fri May 13 16:28:00 2011 for CCNx for Android by  doxygen 1.6.3