Examples of CommandId


Examples of net.sf.myway.gps.garmin.datatype.CommandId

  /** @return <code>true</code> wenn Message zu Protokol paßt */
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.ACKNOWLEDGE)) {
      final CommandId cmd = message.getData().getCommandId();
      if (cmd.getId() == _linkProtocol.getId(DataTypeName.PRODUCT_REQUEST))
        return true;
      return false;
    }
    if (_linkProtocol.getType(message).equals(DataTypeName.PRODUCT_DATA)) {
      _result = new GarminProductData(message.getData());
      final CommandId cmd = new CommandId(_linkProtocol.getId(DataTypeName.PRODUCT_DATA));
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      checkComplete(cmd.getData());
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   */
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.PRODUCT_EXTRA_DATA)) {
      _result = message.getData();
      final CommandId cmd =
        new CommandId(_linkProtocol.getId(DataTypeName.PRODUCT_EXTRA_DATA));
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      _complete = true;
      setNextProtocol(_protocolCapabilityProtocol);
      return true;
    }
    return false;
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   */
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.PROTOCOL_ARRAY)) {
      _result = new ProtocolArray(message.getData());
      final CommandId cmd = new CommandId(message.getId());
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      _complete = true;
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   * Method getCommandId.
   *
   * @return CommandId
   */
  public CommandId getCommandId() {
    return new CommandId(getInt(0));
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   */
  @Override
  public boolean addMessage(final GarminMessage message) {
    // only accept a COMMAND_DATA ACKNOWLEDGE
    if (_linkProtocol.getType(message).equals(DataTypeName.ACKNOWLEDGE)) {
      final CommandId cmd = message.getData().getCommandId();
      if (cmd.getId() == _linkProtocol.getId(DataTypeName.COMMAND_DATA))
        return true;
    }
    return false;
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   * @see net.sf.myway.gps.garmin.protocol.Protocol#addMessage(net.sf.myway.gps.garmin.unit.GarminMessage)
   */
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.ACKNOWLEDGE)) {
      final CommandId cmd = message.getData().getCommandId();
      if (cmd.getId() == _linkProtocol.getId(DataTypeName.COMMAND_DATA))
        return true;
      return false;
    }
    if (_linkProtocol.getType(message).equals(getDataTypename())) {
      _result = _dataType.parseData(message.getData());
      final CommandId cmd = new CommandId(_linkProtocol.getId(getDataTypename()));
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      _complete = true;
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   *
   * @param command
   * @return GarminData
   */
  GarminData getCommand(final CommandName command) {
    final CommandId cmd = new CommandId(getId(command));
    return cmd.getData();
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

   * @see net.sf.myway.gps.garmin.protocol.sourceforge.myway.gps.garmin.Protocol#addMessage(GarminSerialMessage)
   */
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.ACKNOWLEDGE)) {
      final CommandId cmd = message.getData().getCommandId();
      if (cmd.getId() == _linkProtocol.getId(DataTypeName.COMMAND_DATA))
        return true;
      return false;
    }
    if (_linkProtocol.getType(message).equals(DataTypeName.PVT_DATA)) {
      final D800PvtData pvt = new D800PvtData();
      pvt.parseData(message.getData());
      _result = pvt;
      final CommandId cmd = new CommandId(_linkProtocol.getId(DataTypeName.PVT_DATA));
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      _complete = true;
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.sf.myway.gps.garmin.datatype.CommandId

  /** @return <code>true</code> wenn Message zu Protokol paßt */
  @SuppressWarnings("unchecked")
  @Override
  public boolean addMessage(final GarminMessage message) {
    if (_linkProtocol.getType(message).equals(DataTypeName.ACKNOWLEDGE)) {
      final CommandId cmd = message.getData().getCommandId();
      if (cmd.getId() == _linkProtocol.getId(_typeSent)) {
        if (_typeSent.equals(DataTypeName.RECORDS)) {
          _packageIndex = 0;
          final TypedData d = _packageData[_packageIndex++];
          _typeSent = d.getType();
          _linkProtocol.sendPackage(d.getType(), d.getData(), false);
        }
        else if (_typeSent.equals(DataTypeName.WPT_DATA)) {
          if (_packageIndex < _packageData.length) {
            final TypedData d = _packageData[_packageIndex++];
            _typeSent = d.getType();
            _linkProtocol.sendPackage(d.getType(), d.getData(), false);
          }
          else {
            final GarminData gd = new GarminData(new byte[2]);
            gd.setInt(0, _linkProtocol.getId(_typeToSend));
            _typeSent = DataTypeName.XFER_CMPLT;
            _linkProtocol.sendPackage(DataTypeName.XFER_CMPLT, gd, false);
          }
        }
        else if (_typeSent.equals(DataTypeName.XFER_CMPLT))
          _complete = true;
        return true;
      }
      return false;
    }
    else if (_linkProtocol.getType(message).equals(DataTypeName.RECORDS)) {
      _result = new ArrayList<Integer>(message.getData().getInt(0));
      final CommandId cmd = new CommandId(_linkProtocol.getId(DataTypeName.RECORDS));
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      return true;
    }
    else if (_linkProtocol.getType(message).equals(DataTypeName.XFER_CMPLT)) {
      CommandId cmd = message.getData().getCommandId();
      final CommandName type = _deviceCommandProtocol.getType(cmd.getId());
      if (!type.equals(_command))
        System.err.println("incompatible type " + type + " != " + _command);
      _complete = true;
      _result =
        _builder.buildResult(parseSequence(_linkProtocol, (List<GarminMessage>) _result));
      cmd = new CommandId(message.getId());
      _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
      return true;
    }
    ((List<GarminMessage>) _result).add(message);
    final CommandId cmd = new CommandId(message.getId());
    _linkProtocol.sendPackage(DataTypeName.ACKNOWLEDGE, cmd.getData(), false);
    return true;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.