Package org.nfctools.ndef.wkt.records

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


  public static SmartPosterRecord createSmartPoster() {
    SmartPosterRecord spr = new SmartPosterRecord();
    spr.setTitle(new TextRecord("Hello, this is a SmartPosterTag for NFC Tools", Charset.forName("UTF8"),
        Locale.ENGLISH));
    spr.setUri(new UriRecord("http://www.nfctools.org"));
    spr.setAction(new ActionRecord(Action.DEFAULT_ACTION));
    return spr;
  }
View Full Code Here


  @Test
  public void testEncode2() throws Exception {
    SmartPosterRecord smartPosterRecord = new SmartPosterRecord();
    smartPosterRecord.setTitle(new TextRecord("Title", Charset.forName("UTF8"), Locale.GERMANY));
    smartPosterRecord.setUri(new UriRecord("http://www.winfuture.de"));
    smartPosterRecord.setAction(new ActionRecord(Action.DEFAULT_ACTION));
    byte[] payload = messageEncoder.encodeSingle(smartPosterRecord);
    assertEquals(SmartPosterDecoderTest.smartPoster, NfcUtils.convertBinToASCII(payload));
  }
View Full Code Here

public class ActionRecordDecoder implements WellKnownRecordPayloadDecoder {

  @Override
  public WellKnownRecord decodePayload(byte[] payload, NdefMessageDecoder messageDecoder) {
    Action action = Action.getActionByValue(payload[0]);
    return new ActionRecord(action);
  }
View Full Code Here

public class ActionRecordEncoder implements WellKnownRecordPayloadEncoder {

  @Override
  public byte[] encodePayload(WellKnownRecord wellKnownRecord, NdefMessageEncoder messageEncoder) {
    ActionRecord record = (ActionRecord)wellKnownRecord;
    if (!record.hasAction()) {
      throw new NdefEncoderException("Expected action", wellKnownRecord);
    }
    return new byte[] { record.getAction().getValue() };
  }
View Full Code Here

TOP

Related Classes of org.nfctools.ndef.wkt.records.ActionRecord

Copyright © 2018 www.massapicom. 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.