iomz / golemu

A simple LLRP-based RFID reader emulator in Go
MIT License
19 stars 9 forks source link

Is there an example for the API to add/delete tags? #33

Open HanYangZhao opened 4 years ago

HanYangZhao commented 4 years ago

I'm trying to figure out what do put in the json parameters, but I'm unsure as to put in "length" and "readData" from swagger.yaml

iomz commented 4 years ago

The swagger description is totally outdated as I shifted from the Web API to the simulator mode as I needed to deal with thousands of tags – with the Web API the latency/overhead was too high. The length was the total length for non-GS1 EPC and readData was the C1G2ReadOpSpecResult's ReadData to simulate the read of the user memory.

The web API is, however, still available in server mode simply taking TagRecord from go-llrp.

E.g.,

% cat tags.json
[
    {
        "PCbits": "3000",
        "EPC": "307227627f2ea48000001c6a"
    }
]
% curl -X POST http://localhost:8080/api/v1/tags -d @tags.json
HanYangZhao commented 4 years ago

I tried it and it worked! However, golemu doesn't seem to respond to any other curl request after the initial one. All requests seems to hang forever

iomz commented 4 years ago

It seems golemu now has a bug with the deprecated BindWith(). The HTTP connection handling should be fixed.

HanYangZhao commented 4 years ago

I updated BindWith() to MustBindWith(), problem still seems to persists