org.ocap.system

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package org.ocap.system

This API is used to access system modules.

See:
Description

Interface Summary
EASHandler | An OCAP-J application can register an EASHandler to the EASModuleRegistrar via the `EASModuleRegistrar.registerEASHandler(org.ocap.system.EASHandler)` method.
EASListener | This interface represents a listener that will receive EAS events.
SystemModule | The SystemModule is used by an OCAP-J application to send an APDU to the CableCARD device.
SystemModuleHandler | The SystemModuleHandler is used by an OCAP-J application for the following purposes: 1) receive an APDU from the CableCARD device, 2) detect an unsent APDU to the POD in case of an error, and 3) notification of becoming registered and unregistered.

Class Summary
EASEvent | This class represents an EAS event.
EASManager | This class represents a manager that allows applications to register listeners for EAS events.
EASModuleRegistrar | An OCAP-J application can set and get a preferred attribute value of an EAS alert text.
MonitorAppPermission | The MonitorAppPermission class represents permission to execute privileged operations only Monitor Application should be granted.
RegisteredApiManager | This class represents a manager for registered APIs that can be registered with an implementation by a privileged application.
RegisteredApiUserPermission | The RegisteredApiUserPermission class represents permission for an application to use a specific registered API.
SystemModuleRegistrar | This class is used by an OCAP-J application to access a system module.

## Package org.ocap.system Description

This API is used to access system modules.

Example of application access of Specific Application Resource

This is sample code for accessing the Specific Application Resource. See also Section 20.2.2.4.1.

import org.ocap.system.*;

public class PrivateHostApp implements SystemModuleHandler {

SystemModule sm; // A SystemModule returns by ready() method.

SystemModuleRegistrar registrar;

// Note that this is not an actual byte data.

byte[] privateHostAppID = {0x01, 0x23, 0x45, 0x67};

/**

* Constructor of this class.

* Register this class as a Private Host Application.

*/

public PrivateHostApp() {

registrar = SystemModuleRegistrar.getInstance();

// Note that a current resident Private Host Application

// (ID=0x01234567) will terminate by this method call.

registrar.registerSASHandler(this, privateHostAppID);

}

/**

* Unregister this class, i.e., terminate assuming.

*/

public void unregister() {

// Unregister itself.

registrar.unregisterSASHandler(privateHostAppID);

}

/**

* Define the receiveAPDU() method in the SystemModuleHandler.

*/

public void receiveAPDU(int apduTag, int lengthField, byte[] dataByte) {

// Define a process for each receiving APDU here.

}

/**

* Define the sendAPDUFailed() method in the SystemModuleHandler.

*/

public void sendAPDUFailed(int apduTag, byte[] dataByte) {

// Define an error recovery for each receiving APDU here.

// For example, re-send it.

sm.sendAPDU(apduTag, dataByte);

}

/**

* Define the notifyUnregister() method in the SystemModuleHandler.

*/

public void notifyUnregister() {

// Terminate activity and communication with the POD.

// Return immediately!

// Write a termination procedure here.

}

/**

* Define the ready() method in the SystemModuleHandler.

*/

public void ready(SystemModule systemModule) {

// Note that this is not an actual byte data.

int sasDataRqstApduTag = 0x9F9A02;

byte[] sas_data_rqst_byte = {0x01, 0x23, 0x45, 0x67};

//Start communication with the POD.

sm = systemModule;

sm.sendAPDU(sasDataRqstApduTag, sas_data_rqst_byte);

}

}

Example of accessing MMI Resource

This is sample code for accessing MMI Resource. See also Section 20.2.2.4.2.

import org.ocap.system.*;

import org.ocap.hardware.pod.*;

public class MMI implements SystemModuleHandler{

SystemModule sm; // A SystemModule returns by ready() method.

SystemModuleRegistrar registrar;

/**

* Constructor of this class.

* Register this class to access MMI.

*/

public MMI() {

registrar = SystemModuleRegistrar.getInstance();

// Note that a resident MMI doesn't terminate by this method call.

registrar.registerMMIHandler(this);

POD pod = POD.getInstance();

PODApplication[] apps = pod.getApplications();

String url = apps[0].getURL();

}

/**

* Unregister this class, i.e., terminate registration.

*/

public void unregister() {

//Unregister itself.

registrar.unregisterMMIHandler();

}

/**

* Define the receiveAPDU() method in the SystemModuleHandler.

*/

public void receiveAPDU(int apduTag, int lengthField, byte[] dataByte) {

// Define a process for each receiving APDU here.

// For example, draw a new MMI dialogue.

}

/**

* Define the sendAPDUFailed() method in the SystemModuleHandler.

*/

public void sendAPDUFailed(int apduTag, byte[] byteData) {

// Define a error recovery for each receiving APDU here.

// For example, re-send it.

sm.sendAPDU(apduTag, byteData);

}

/**

* Define the notifyUnregister() method in the SystemModuleHandler.

*/

public void notifyUnregister() {

// Terminate activity and communication with the POD.

// Return immediately!

// Write a termination procedure here.

}

/**

* Define the ready() method in the SystemModuleHandler.

*/

public void ready(SystemModule systemModule) {

// Note that this is not an actual byte data.

int serverQueryApduTag = 0x9F8022;

byte[] server_query_byte = {0x12, 0x34, 0x56};

// Start communication with the POD.

sm = systemModule;

sm.sendAPDU(serverQueryApduTag, server_query_byte);

}

}

Example of setting EAS Audio and Display Attributes

This is sample code for OCAP-J application management of audio presentation and setting of EASdisplay attributes. See also Section 20.2.3.10.

import org.ocap.system.*;

/**

* This is a sample implementation of EAS manager.

*/

public class EASModule implements EASHandler {

/**

* Constructor of this class.

* The EASmodule class is a part of the Monitor Application. It SHALL

* have a MonitorAppPermission("handler.eas") permission.

*/

public EASModule() {

try {

EASModuleRegistrar easmr = EASModuleRegistrar.getInstance();

easmr.registerEASHandler(this);

//Investigate possible font colors.

java.awt.Color fontColor[] =

(java.awt.Color[])easmr.getEASCapability(

EASModuleRegistrar.EAS_ATTRIBUTE_FONT_COLOR);

//Investigate possible font styles.

String fontStyle[] =

(String[])easmr.getEASCapability(

EASModuleRegistrar.EAS_ATTRIBUTE_FONT_STYLE);

//Investigate possible font face.

String fontFace[] =

(String[])easmr.getEASCapability(

EASModuleRegistrar.EAS_ATTRIBUTE_FONT_FACE);

//Set a preferred font color/style/face.

//(Set the first item for every attribute as a sample.

//An actual Monitor Application may provide a GUI to select

//user preferences.)

int attributes[] = {EASModuleRegistrar.EAS_ATTRIBUTE_FONT_COLOR,

EASModuleRegistrar.EAS_ATTRIBUTE_FONT_STYLE,

EASModuleRegistrar.EAS_ATTRIBUTE_FONT_FACE};

Object values[] = {fontColor[0], fontStyle[0], fontFace[0]};

easmr.setEASAttribute(attributes, values);

}

catch (Exception e) {

}

}

/**

* Defined in EASHandler.

*/

public boolean notifyPrivateDescriptor(byte[] descriptor) {

// Play audio according to the descriptor.

return(true);

}

/**

* Defined in EASHandler.

*/

public void stopAudio() {

//Stop audio that was informed by notifyPrivateDescriptor() method.

}

}

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES