Package org.nfctools.llcp.parameter

Examples of org.nfctools.llcp.parameter.ServiceName


    assertEquals(1, connect.getDestinationServiceAccessPoint());
    assertEquals(33, connect.getSourceServiceAccessPoint());

    Object[] parameter = connect.getParameter();
    assertEquals(1, parameter.length);
    ServiceName serviceName = (ServiceName)parameter[0];
    assertEquals("com.android.npp", serviceName.getName());

  }
View Full Code Here


    assertEquals(0xffff, wks.getValue());

    LinkTimeOut lto = (LinkTimeOut)parameter[pId++];
    assertEquals(255, lto.getValue());

    ServiceName serviceName = (ServiceName)parameter[pId++];
    assertEquals("com.android.npp", serviceName.getName());

  }
View Full Code Here

    assertTrue(protocolDataUnit instanceof Symmetry);
  }

  @Test
  public void testConnectUnavailableService() throws Exception {
    Connect connect = new Connect(0x01, 0x32, new ServiceName(COM_ANDROID_NPP));
    AbstractProtocolDataUnit processPdu = connect.processPdu(connectionManager);
    assertTrue(processPdu instanceof DisconnectedMode);
    assertEquals(2, ((DisconnectedMode)processPdu).getReason());
  }
View Full Code Here

    assertEquals(2, ((DisconnectedMode)processPdu).getReason());
  }

  @Test
  public void testConnectUnavailableAddress() throws Exception {
    Connect connect = new Connect(0x02, 0x32, new ServiceName(COM_ANDROID_NPP));
    AbstractProtocolDataUnit processPdu = connect.processPdu(connectionManager);
    assertTrue(processPdu instanceof DisconnectedMode);
    assertEquals(2, ((DisconnectedMode)processPdu).getReason());
  }
View Full Code Here

  @Test
  public void testConnectWellKnownServiceWithServiceUnavailable() throws Exception {
    DummyServiceAccessPoint serviceAccessPoint = new DummyServiceAccessPoint(COM_ANDROID_NPP);
    serviceAccessPoint.setAcceptConnections(false);
    connectionManager.registerWellKnownServiceAccessPoint(COM_ANDROID_NPP, serviceAccessPoint);
    Connect connect = new Connect(0x01, 0x32, new ServiceName(COM_ANDROID_NPP));
    AbstractProtocolDataUnit processPdu = connect.processPdu(connectionManager);
    assertTrue(processPdu instanceof DisconnectedMode);
    assertEquals(3, ((DisconnectedMode)processPdu).getReason());
  }
View Full Code Here

  }

  @Test
  public void testConnectWellKnownService() throws Exception {
    connectionManager.registerWellKnownServiceAccessPoint(COM_ANDROID_NPP, new DummyServiceAccessPoint());
    Connect connect = new Connect(0x01, 0x32, new ServiceName(COM_ANDROID_NPP));
    AbstractProtocolDataUnit processPdu = connect.processPdu(connectionManager);
    assertTrue(processPdu instanceof ConnectComplete);
  }
View Full Code Here

  @Test
  public void testWellKnownServiceConnectWithReceiveAndDisconnect() throws Exception {
    DummyServiceAccessPoint serviceAccessPoint = new DummyServiceAccessPoint(COM_ANDROID_NPP);
    connectionManager.registerWellKnownServiceAccessPoint(COM_ANDROID_NPP, serviceAccessPoint);
    AbstractProtocolDataUnit processPdu = new Connect(1, 32, new ServiceName(COM_ANDROID_NPP))
        .processPdu(connectionManager);
    assertTrue(processPdu.toString(), processPdu instanceof ConnectComplete);
    assertEquals(1, connectionManager.getOpenConnectionsSize());

    processPdu = new Information(32, 32, 0, 0, "Hello".getBytes()).processPdu(connectionManager);
View Full Code Here

  }

  @Override
  public void connectToService(String serviceName, ServiceAccessPoint serviceAccessPoint) {
    // TODO move this to llcpsocket
    Object[] parameter = { new ServiceName(serviceName) };
    // TODO MIUX
    int outgoingAddress = getFreeOutgoingAddress();
    Connect connectPdu = new Connect(SERVICE_DISCOVERY_ADDRESS, outgoingAddress, parameter);
    pendingConnections.put(outgoingAddress, new PendingConnection(serviceAccessPoint, System.currentTimeMillis(),
        connectPdu));
View Full Code Here

          byte minor = (byte)(pduData[offset + 2] & 0x0F);
          params.add(new Version(major, minor));
          break;
        case PduConstants.PARAM_SN:
          String serviceName = new String(pduData, offset + 2, pduData[offset + 1]);
          params.add(new ServiceName(serviceName));
          break;
        case PduConstants.PARAM_MIUX:
          int miux = (pduData[offset + 2] & 0x03) << 8 | (pduData[offset + 3] & 0xFF);
          params.add(new Miux(miux));
          break;
View Full Code Here

TOP

Related Classes of org.nfctools.llcp.parameter.ServiceName

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.