Skip Navigation

Sample Code for Emulator Services

You can use the following code samples as a resource for using Sabre emulator services:

Sending a Command or Message to the Emulator

 

        String command = "1LASLAX";
        boolean isCommand = true;

        ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);
        ShowInEmuServiceClient showClient = new ShowInEmuServiceClient(com);

        EmulatorCommand cmd = new EmulatorCommand(command);
        cmd.setIsCommand(isCommand);
        EmulatorCommandRequest request = new EmulatorCommandRequest(cmd);
        showClient.send(request);

 

Sending a Command to the Host Through the Emulator

 

        String command = "1LASLAX";
        boolean showCommand = true;
        boolean showResponse = true;

        ISRWCommunication COM = Activator.getDefault().getServiceReference(ISRWCommunication.class);
        ExecuteInEmuServiceClient exeClient = newExecuteInEmuServiceClient(COM);

        EmulatorCommand cmd = new EmulatorCommand(command);
        cmd.setShowResponse(showResponse);
        cmd.setShowCommand(showCommand);
        EmulatorCommandRequest request = new EmulatorCommandRequest(cmd);
        exeClient.send(request);