Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Parse to Json #2

Open
baardl opened this issue Nov 16, 2019 · 0 comments
Open

Parse to Json #2

baardl opened this issue Nov 16, 2019 · 0 comments

Comments

@baardl
Copy link
Contributor

baardl commented Nov 16, 2019

    @Test
    public void buildApdu() throws BACnetException {
        String byteHex = "100209001c020007d12c020007d139004e09702e91002f09cb2e2ea4770b0105b40d2300442f2f09c42e91002f4f";
        final ByteQueue queue = new ByteQueue(byteHex);
        ServicesSupported services = new ServicesSupported();
        services.setAll(true);
        APDU apdu = APDU.createAPDU(services, queue);
        assertNotNull(apdu);
        assertTrue(apdu instanceof UnconfirmedRequest);
        Gson gson = new GsonBuilder()
                .registerTypeAdapter(Encodable.class, new EncodableAdapter())
                .setPrettyPrinting()
                .serializeNulls()
                .create();
        UnconfirmedRequest unconfirmedRequest = (UnconfirmedRequest)apdu;
        unconfirmedRequest.parseServiceData();
        UnconfirmedRequestService service = unconfirmedRequest.getService();
        String json = gson.toJson(service);
        System.out.println(json);

    }

baardl pushed a commit that referenced this issue Nov 16, 2019
baardl pushed a commit that referenced this issue Nov 16, 2019
baardl added a commit that referenced this issue Dec 9, 2019
baardl added a commit that referenced this issue Dec 9, 2019
baardl added a commit that referenced this issue Dec 9, 2019
baardl added a commit that referenced this issue Dec 9, 2019
baardl added a commit that referenced this issue Dec 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant