Getting Started with Ocap, part 2nd: Writing applications for Ocap RI

Source: Internet
Author: User
Tags command line java se linux

Part 1th of this series introduces you to the OpenCable application Platform (OCAP)-Platform for interactive cable TV applications-and OCAP Reference implementation (RI). You have learned that the OCAP structure is based on 3 specifications, which are part of the standard Java ME technology:

Connected Device Configuration (CDC) describes a JVM and a set of basic APIs.

Foundation profile (FP) provides other APIs.

Personal Basis Profile (PBP) provides graphic functionality.

In the case of Java, Standard Edition (Java SE), the CDC/FP/PBP stack is almost identical to the Java Development Kit (JDK) 1.4.2. But don't take it too seriously-it's just an analogy to help you understand the CDC/FP/PBP stack.

In the 1th part, you run several demo applications that are bound to RI. In this article, you will learn how to create applications that can run on RI and other OCAP devices. You will first use the command line and then use the Eclipse's OCAP plug-in.

Cross-compilation

In general, the build of a OCAP application is an example of a cross compilation, that is, you build an application on one platform, but you plan to run it on another platform. For small platforms such as mobile phones, the concept of cross compilation is well understood. Mobile phone applications are not built on the mobile phone itself. Typically, you use a desktop computer (host) to create an application that will run on a mobile phone (the target). Similarly, you can use a Java SE environment on your desktop computer to build applications that will run on the OCAP platform.

This is where the trouble lies. The OCAP RI that you downloaded in part 1th is also running on your desktop computer, but it is indeed an emulator. OCAP RI simulates your computer as a set-top box.

However, if you build a OCAP application, it should be able to run on any OCAP platform, whether it's a real set-top box or an emulator like OCAP RI.

Hone your character on the command line

Parents often warn their children that anything unpleasant can help hone their character. Don't forget this when you use command-line tools to build your OCAP application. You will certainly learn a lot about how the build process works. Even if you choose to use Eclipse to build your OCAP application (which is described later in this article), performing the build steps on the command line will help you understand more deeply what Eclipse has done for you.

Constructing the architecture of OCAP implementation

Terminology description

The OCAP code itself can be built on a variety of platforms, including real devices. In addition, you can build OCAP code that runs on the RI platform, a layer that simulates OCAP devices on Windows or Linux desktop computers. The OCAP RI includes the OCAP implementation and RI platform.

Although you did not download the full source code for the OCAP ri, the binary OCAP ri that you installed in part 1th has a similar directory structure. Understanding this structure will help you locate important files and directories.

An important position is ocaproot, which is the root of the OCAP implementation source code. It is the root of a rather complex tree that supports building code on different hosts, targeting multiple targets. For example, you can build OCAP implementations on a single Linux computer for a particular set-top box. Alternatively, you can build on the OCAP RI platform on a Windows computer.

The actual value of the ocaproot depends on where the OCAP RI binaries are installed. If you use the default installation location, this value is/cablelabs/tru2way/ocap-ri/ocap. (although Windows typically uses backslashes as the path separator, this article uses a forward slash as the path separator for consistency.) )

When you build the OCAP implementation, the results are stored in the ${ocaproot}/bin directory. Specifically, these results are placed in a subfolder whose name reflects the target platform. This target platform is represented by OCAPTC and the build results are stored in the ${OCAPROOT}/BIN/${OCAPTC} folder.

For example, when you build a Windows OCAP stack, OCAPTC is cablelabs/simulator/win32/debug.

Discover what is needed in OCAP builds

A successful build of the OCAP implementation will generate some Java class files and local libraries. To build a OCAP application, all you really need to care about is the class file that defines the platform.

The OCAP Java platform is packaged as two JAR files:

${ocaproot}/bin/${ocaptc}/env/cvm/lib/basis.jar is the CDC/FP/PBP stack.

${ocaproot}/bin/${ocaptc}/env/sys/ocap-classes.jar contains all Java classes that are implemented by OCAP.

Several lines in the code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.