/** * Unregister a previously registered keyed message listener. * * @param message The message with the key this listener was previously * registered to receive. * @param listener The listener to remove. */ public void removeListener(KeyedMessage message, VehicleMessage.Listener listener) { removeListener(message.getKey(), listener); }
@Override public boolean equals(Object obj) { if(!super.equals(obj) || !(obj instanceof CanMessage)) { return false; } final CanMessage other = (CanMessage) obj; return mId == other.mId && mBusId == other.mBusId && Arrays.equals(mData, other.mData); }
@Override protected void readFromParcel(Parcel in) { super.readFromParcel(in); mName = in.readString(); }
@Test public void testSerialize() throws DataSinkException { KeyedMessage measurement = new SimpleVehicleMessage(measurementId, value); measurement.asKeyedMessage().getKey(); String serializedMessage = JsonFormatter.serialize(measurement); assertTrue(!serializedMessage.contains("mKey")); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); final int N = commands.size(); out.writeInt(N); if (N > 0) { for (Map.Entry<String, String> entry : commands.entrySet()) { out.writeString(entry.getKey()); String dat = entry.getValue(); out.writeString(dat); } } }
@Override public int compareTo(VehicleMessage other) { NamedVehicleMessage otherMessage = (NamedVehicleMessage) other; int nameComp = getName().compareTo(otherMessage.getName()); return nameComp == 0 ? super.compareTo(other) : nameComp; }
@Test public void toStringNotNull() { assertThat(keyed.toString(), notNullValue()); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getName()); }
/** * Return true if the message's key matches this key matcher. */ public boolean matches(KeyedMessage other) { return matches(other.getKey()); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(getCommand()); out.writeInt(getStatus() ? 1 : 0); out.writeString(getMessage()); }
@Override protected void readFromParcel(Parcel in) { super.readFromParcel(in); command = in.readString(); status = in.readInt() == 1; message = in.readString(); }
@Override public boolean equals(Object obj) { if(!super.equals(obj) || getClass() != obj.getClass()) { return false; } final NamedVehicleMessage other = (NamedVehicleMessage) obj; return mName.equals(other.mName); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeInt(getStatus() ? 1 : 0); out.writeString(getMessage()); }
@Override protected void readFromParcel(Parcel in) { super.readFromParcel(in); final int N = in.readInt(); for (int i = 0; i < N; i++) { String key = in.readString(); String value = in.readString(); commands.put(key, value); } }
@Override public boolean equals(Object obj) { if(!super.equals(obj) || !(obj instanceof CommandResponse)) { return false; } final CommandResponse other = (CommandResponse) obj; return Objects.equal(mCommand, other.mCommand) && Objects.equal(mMessage, other.mMessage) && Objects.equal(mStatus, other.mStatus); }
public static ExactKeyMatcher buildExactMatcher(final KeyedMessage keyed) { return buildExactMatcher(keyed.getKey()); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(getBusId()); out.writeInt(getId()); out.writeByteArray(getData()); }
@Override public void readFromParcel(Parcel in) { super.readFromParcel(in); mBusId = in.readInt(); mId = in.readInt(); in.readByteArray(mData); }
@Override public boolean equals(Object obj) { if(!super.equals(obj) || !(obj instanceof CustomCommandResponse)) { return false; } final CustomCommandResponse other = (CustomCommandResponse) obj; return Objects.equal(command, other.command) && Objects.equal(message, other.message) && Objects.equal(status, other.status); }