Однако мне не удалось заставить ее работать в приложении Sabre Web Red. . Я не уверен, что делать и следует ли мне использовать Service или EventListner?
Вот код, который я использую в Sabre Red:
В моем redapp.xml:
Код: Выделить всё
Код: Выделить всё
Код: Выделить всё
public class CommandModificationService implements IService
{
@Override
public void process(IServiceContext context)
{
ContextStatusAdvisor contextAdvisor = new ContextStatusAdvisor(context,getClass());
IRequest request = context.getRequest();
if (request instanceof EmulatorCommandRequest)
{
// Obtain the intercepted command
EmulatorCommandRequest commandRequest = (EmulatorCommandRequest) request;
EmulatorCommand command = commandRequest.getEmulatorCommand();
if (command.getCommand().startsWith("TEST")){
System.out.println("Testing,testing,123");
}
}
}
}
Код: Выделить всё
import { ICommandMessageService } from "sabre-ngv-commsg/services/ICommandMessageService";
import { CommandMessageBasicRs } from "sabre-ngv-pos-cdm/commsg";
import { getService } from "../Context";
import { ErrorAwareRs } from "../model/ErrorAwareRs";
export class TestService {
public async sendCommandToEmu(){
console.log("Hello world command.");
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... r-commands