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 stopAll ()
 Stop the CCN daemon and Repo This call will unbind from the service and stop it.
boolean checkSystemOK ()
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)
void setSyncOption (CCNS_OPTIONS option, String value)
void setCcnrOption (CCNR_OPTIONS option, String value)
String getErrorMessage ()
void clearErrorMessage ()
boolean isAllRunning ()
 Are ccnd and the repo running and ready?
SERVICE_STATUS getCcndStatus ()
SERVICE_STATUS getRepoStatus ()

Static Public Attributes

static final Long MINIMUM_SECONDS_SINCE_EPOCH = 946684800L

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

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.isAllRunning (  ) 

Are ccnd and the repo running and ready?

Returns:
true if BOTH ccnd and the repo are in state 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.stopAll (  ) 

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;
                        case SERVICE_ERROR:
                                newCCNxAPIStatus(SERVICE_STATUS.SERVICE_ERROR);
                                break;
                        default:
                                Log.d(TAG, "ccndCallback, ignoring status = " + st.toString());
                        }
                }
        }
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;
                        case SERVICE_ERROR:
                                newCCNxAPIStatus(SERVICE_STATUS.SERVICE_ERROR);
                                break;
                        default:
                                Log.d(TAG, "repoCallback, ignoring status = " + st.toString());
                        }
                }
        }

The documentation for this class was generated from the following file:
Generated on Tue Aug 21 14:55:41 2012 for CCNx for Android by  doxygen 1.6.3