Examples of GcTargetRecord


Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

*
*/
public class NdefExampleRecords {

  public static GenericControlRecord createVibrateModeGc() {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new TextRecord("PropertyManager")));
    gcr.setAction(new GcActionRecord(new TextRecord("SilentMode")));
    gcr.setData(new GcDataRecord(new TextRecord("VIBRATE")));
    return gcr;
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

    gcr.setData(new GcDataRecord(new TextRecord("VIBRATE")));
    return gcr;
  }

  public static GenericControlRecord createNavigationGc() {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new TextRecord("Navigation")));
    gcr.setAction(new GcActionRecord(Action.DEFAULT_ACTION));
    gcr.setData(new GcDataRecord(new TextRecord("D", "Street 3, 12345 City")));
    return gcr;
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

    gcr.setData(new GcDataRecord(new TextRecord("D", "Street 3, 12345 City")));
    return gcr;
  }

  public static GenericControlRecord createSilentModeGc() {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new TextRecord("PropertyManager")));
    gcr.setAction(new GcActionRecord(new TextRecord("SilentMode")));
    gcr.setData(new GcDataRecord(new TextRecord("ON")));
    return gcr;
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

    gcr.setData(new GcDataRecord(new TextRecord("ON")));
    return gcr;
  }

  public static GenericControlRecord createSilentModeOffGc() {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new TextRecord("PropertyManager")));
    gcr.setAction(new GcActionRecord(new TextRecord("SilentMode")));
    gcr.setData(new GcDataRecord(new TextRecord("OFF")));
    return gcr;
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

    gcr.setData(new GcDataRecord(new TextRecord("OFF")));
    return gcr;
  }

  public static GenericControlRecord createWifiSetting() {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new TextRecord("WifiManager")));
    gcr.setAction(new GcActionRecord(Action.DEFAULT_ACTION));
    gcr.setData(new GcDataRecord(new TextRecord("T", "WPA"), new TextRecord("S", "somelan"), new TextRecord("P",
        "26888282a6eff09dbc7e91e61dccf99bd660881ea69a6fad5941288f6cbc0f35")));
    return gcr;
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

  public static final byte[] dataBytes = { (byte)0xd1, 0x01, 0x09, 0x54, 0x05, 0x65, 0x6e, 0x2d, 0x55, 0x53, 0x35,
      0x30, 0x30 };

  @Test
  public void testEncode() throws Exception {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new UriRecord(
        "file://localhost/Appli/CustomerBonus")));

    gcr.setAction(new GcActionRecord(new TextRecord("add", Charset.forName("utf8"), Locale.US)));
    gcr.setData(new GcDataRecord(new TextRecord("500", Locale.US)));
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

    assertArrayEquals(GenericControlRecordDecoderTest.payload, encodedGcr);
  }

  @Test
  public void testEncodeSimple() throws Exception {
    GenericControlRecord gcr = new GenericControlRecord(new GcTargetRecord(new UriRecord("http://localhost/test")));
    byte[] encodedGcr = messageEncoder.encodeSingle(gcr);

    assertEquals(encodedNdefSimple, NfcUtils.convertBinToASCII(encodedGcr));
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

public class GcTargetRecordEncoder implements WellKnownRecordPayloadEncoder {

  @Override
  public byte[] encodePayload(WellKnownRecord wellKnownRecord, NdefMessageEncoder messageEncoder) {
    GcTargetRecord gcTargetRecord = (GcTargetRecord)wellKnownRecord;
    if (!gcTargetRecord.hasTargetIdentifier()) {
      throw new NdefEncoderException(wellKnownRecord.getClass().getSimpleName()
          + " must have target identifier", wellKnownRecord);
    }
    return messageEncoder.encodeSingle(gcTargetRecord.getTargetIdentifier());
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

public class GcTargetRecordDecoder implements WellKnownRecordPayloadDecoder {

  @Override
  public WellKnownRecord decodePayload(byte[] payload, NdefMessageDecoder messageDecoder) {
    Record record = messageDecoder.decodeToRecord(payload);
    return new GcTargetRecord(record);
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.records.GcTargetRecord

  public WellKnownRecord decodePayload(byte[] payload, NdefMessageDecoder messageDecoder) {
    byte configurationByte = payload[0];

    NdefMessage payloadNdefMessage = messageDecoder.decode(payload, 1, payload.length - 1);

    GcTargetRecord target = null;
    GcActionRecord action = null;
    GcDataRecord data = null;

    List<Record> subRecords = messageDecoder.decodeToRecords(payloadNdefMessage);
    for (Record record : subRecords) {
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.