use of org.traccar.model.Typed in project traccar by tananaev.
the class CommandsManager method getCommandTypes.
public Collection<Typed> getCommandTypes(long deviceId, boolean textChannel) {
List<Typed> result = new ArrayList<>();
Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId);
if (lastPosition != null) {
BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol());
Collection<String> commands;
commands = textChannel ? protocol.getSupportedTextCommands() : protocol.getSupportedDataCommands();
for (String commandKey : commands) {
result.add(new Typed(commandKey));
}
} else {
result.add(new Typed(Command.TYPE_CUSTOM));
}
return result;
}
use of org.traccar.model.Typed in project traccar by traccar.
the class CommandsManager method getAllCommandTypes.
public Collection<Typed> getAllCommandTypes() {
List<Typed> result = new ArrayList<>();
Field[] fields = Command.class.getDeclaredFields();
for (Field field : fields) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().startsWith("TYPE_")) {
try {
result.add(new Typed(field.get(null).toString()));
} catch (IllegalArgumentException | IllegalAccessException error) {
Log.warning(error);
}
}
}
return result;
}
use of org.traccar.model.Typed in project traccar by tananaev.
the class NotificationManager method getAllNotificationTypes.
public Set<Typed> getAllNotificationTypes() {
Set<Typed> types = new HashSet<>();
Field[] fields = Event.class.getDeclaredFields();
for (Field field : fields) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().startsWith("TYPE_")) {
try {
types.add(new Typed(field.get(null).toString()));
} catch (IllegalArgumentException | IllegalAccessException error) {
LOGGER.warn("Get event types error", error);
}
}
}
return types;
}
use of org.traccar.model.Typed in project traccar by tananaev.
the class CommandsManager method getCommandTypes.
public Collection<Typed> getCommandTypes(String protocolName, boolean textChannel) {
List<Typed> result = new ArrayList<>();
BaseProtocol protocol = Context.getServerManager().getProtocol(protocolName);
Collection<String> commands;
commands = textChannel ? protocol.getSupportedTextCommands() : protocol.getSupportedDataCommands();
for (String commandKey : commands) {
result.add(new Typed(commandKey));
}
return result;
}
use of org.traccar.model.Typed in project traccar by traccar.
the class CommandsManager method getCommandTypes.
public Collection<Typed> getCommandTypes(long deviceId, boolean textChannel) {
List<Typed> result = new ArrayList<>();
Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId);
if (lastPosition != null) {
BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol());
Collection<String> commands;
commands = textChannel ? protocol.getSupportedTextCommands() : protocol.getSupportedDataCommands();
for (String commandKey : commands) {
result.add(new Typed(commandKey));
}
} else {
result.add(new Typed(Command.TYPE_CUSTOM));
}
return result;
}