Show TOC Start of Content Area

Procedure documentation PIOS Getting Started Example  Locate the document in its SAP Library structure

Use

This example provides a quick walkthrough of the Peripheral Input/Output Services (PIOS) architecture. The process uses the PIOS Client API to set the development environment to test and run an application with the PIOS Emulator, as well as configuring the Emulator printer capability.

 

Prerequisites

You have:

       Installed and configured the SAP NetWeaver Developer Studio.

       Installed the SAP NetWeaver Mobile client.

 

Procedure

       1.      Open the SAP NetWeaver Developer Studio.

 

       2.      Open the desired perspective supported by the PIOS Emulator and create a new project.

 

       3.      Prepare your application in order to successfully execute a method with the following code:

 

import com.sap.ip.me.api.pios.connection.ConnectionType;

import com.sap.ip.me.api.pios.connection.Connector;

import com.sap.ip.me.api.pios.connection.DriverInfo;

import com.sap.ip.me.api.pios.printer.GraphicPrinter;

import com.sap.ip.me.api.pios.printer.PrinterFont;

import com.sap.ip.me.api.pios.printer.PrinterParameters;

 

...

 

      GraphicPrinter gP = null;

        

      try{

        

         Connector conn = Connector.getInstance();

         DriverInfo[] driverInfo = conn.listDrivers(ConnectionType.PRINTER);

         PrinterParameters params = new PrinterParameters(driverInfo[0]);

         params.setPrinterMode(PrinterParameters.GRAPHIC_MODE);

     

         gP = (GraphicPrinter) conn.open(params);

        

         String[] sFonts =           gP.getFontConfigurationManager().listFontNames();

         PrinterFont pF = gP.getFont(sFonts[0]);

         gP.drawText(pF, 10, 10, "Hello World!", 0);

         gP.doPrint(1);

        

         gP.close();

      }

      catch (Throwable error){

         error.printStackTrace();

      }

      finally{

         try{

            gP.close();

         }

         catch (Exception ex){

         }

      }

...

4.       Save your work.

 

5.       Add the Peripheral Support Actions Toolbar to the selected perspective.

 

6.       Choose This graphic is explained in the accompanying text Launch the Peripheral I/O Emulator from the toolbar to start the Emulator.

 

7.       Set the emulator Offline by clicking This graphic is explained in the accompanying text On/Offline, and then click on This graphic is explained in the accompanying text Capability… In the General tab, make sure that Page Measurements is not checked. Select the Media tab and on Type select Continuous. When the Setup Reminder dialog box comes up, select Yes.

              Note

If the Setup Reminder dialog box does not come up, choose This graphic is explained in the accompanying text Setup.

 

8.       In the Printer Setup window, choose the Media tab.

 

9.       Select Continuous_4 and choose OK. The emulator should be back Online.

 

10.   Create a launch configuration to run your application.

 

11.   Choose This graphic is explained in the accompanying text Open the Emulator Launch Configurations Manager from the toolbar to open the Emulator Launch Configurations window.

 

12.   Select the launch configuration that you just created to run your application from the list.

 

13.   Click on the Run button in the Emulator Launch Configurations window.

 

14.   Do any required steps on your application to run the method containing the code above.

 

15.   The message “Hello World!” appears on the emulator printer output.

End of Content Area