andersonhwang / cronus

This project is a midleware of ESL Gen 3.0.
MIT License
9 stars 5 forks source link

Tag calls #4

Open 7978178 opened 1 year ago

7978178 commented 1 year ago

In the D19 documentation there's call to query tag http://192.168.1.100:9071/queryTag but how do I register a tag first with the AP?

andersonhwang commented 1 year ago

Actually there is no tag need to register with the AP. You should understand that this porject is just a demo that you can send data to labels. Once you send an image to a label, it will add the label into a memory cache. Then you can use query tag API. However, you should save the records in your application, in database, or some place.

7978178 commented 1 year ago

ok, so I'm trying to push a tag. the one below is base64 encoded and sent like this

bxs:pushtag bs$ file testfile.png 
testfile.png: PNG image data, 384 x 184, 8-bit/color RGB, non-interlaced
[http] 2023/06/10 09:51:25 HTTP Request: POST /pushImage HTTP/1.1
Host: 192.168.100.80:5000
Content-Type: application/json
{"ImageBase64":"xxx","StoreCode":"0001","TagID":"5500000xxxxx"}

It's a 3.5" tag and I believe my resolution is correct

Get back

HTTP Response: HTTP/1.1 500 Internal Server Error

on the other side I see this log

 dotnet ./Cronus.API.dll 
info: Cronus[0]
      [Cronus]Start send server...
info: Cronus[0]
      [SDK]Cronos.SDK start successfully.
info: Cronus[0]
      [Cronus]Send SDK:OK
info: Cronus[0]
      [Cronus]Start SDK True.
info: Cronus[0]
      [Cronus]Start OK.(Build:1.0.0.0)
info: Cronus[0]
      Try to start send server: OK
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/bs/cronus/Cronus.API/bin/Debug/net6.0/
info: Cronus[0]
      [SDK]AP_REG Store:0001, ID:00, IP:192.168.1.100, Port:5678, MAC:220810110043, Status:Idle
[2:51 PM][APEventHandler]Store Code:0001,AP ID:00,Status:Online
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.
fail: Cronus[0]
      PushImageError

what's wrong here?

andersonhwang commented 1 year ago

I see the error message is HttpsRedirectionMiddleware, so please check the source code line 48, if you see app.UseHttpsRedirection(); app.UseAuthentication();, comment out these lines. And if problem still happen, please check your ImageBase64 string value, and then if you are running this on a Linux server, please check if you have the libSkiaSharp.so file.

7978178 commented 1 year ago

ok I commented out app.UseHttpsRedirection(); and app.UseAuthentication(); is not there in Program.cs

i copied libSkiaSharp.so from the Deploy20230104.tar to bin/debug/net6.0 this is what my directory looks like

~/cronus/Cronus.API/bin/Debug/net6.0$ ls -F
appsettings.Development.json   Microsoft.Extensions.Logging.Abstractions.dll*
appsettings.json               Microsoft.OpenApi.dll*
Cronus.API*                    ref/
Cronus.API.deps.json           runtimes/
Cronus.API.dll                 SDK/
Cronus.API.pdb                 Serilog.dll*
Cronus.API.runtimeconfig.json  Serilog.Extensions.Logging.dll*
Cronus.dll                     SkiaSharp.dll*
Cronus.pdb                     Swashbuckle.AspNetCore.Swagger.dll*
Cronus.SDK.dll                 Swashbuckle.AspNetCore.SwaggerGen.dll*
libSkiaSharp.so*               Swashbuckle.AspNetCore.SwaggerUI.dll*

i still get the same error when I pushImage. i base64 encode my PNG image.

 dotnet Cronus.API.dll 
info: Cronus[0]
      [Cronus]Start send server...
info: Cronus[0]
      [SDK]Cronos.SDK start successfully.
info: Cronus[0]
      [Cronus]Send SDK:OK
info: Cronus[0]
      [Cronus]Start SDK True.
info: Cronus[0]
      [Cronus]Start OK.(Build:1.0.0.0)
info: Cronus[0]
      Try to start send server: OK
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/bs/cronus/Cronus.API/bin/Debug/net6.0/
info: Cronus[0]
      [SDK]AP_REG Store:0001, ID:00, IP:192.168.1.100, Port:5678, MAC:220810110043, Status:Idle
[12:31 AM][APEventHandler]Store Code:0001,AP ID:00,Status:Online
fail: Cronus[0]
      PushImageError
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
file testfile.png 
testfile.png: PNG image data, 384 x 184, 8-bit/color RGB, non-interlaced
7978178 commented 1 year ago

with debug prints, it's failing in this line var image = SKImage.FromEncodedData(memoryStream);

how do I check if this libSkiaSharp.so is even loaded and working?

this is the file I have

sha1sum libSkiaSharp.so 
0c81cceca9358a70802e3c6a4e43c0a4e4f6a4b8  libSkiaSharp.so
7978178 commented 1 year ago

ok doing a

ldd libSkiaSharp.so 
    linux-vdso.so.1 (0x00007ffd2cf6f000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4bb9409000)
    libfontconfig.so.1 => not found
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4bb9404000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4bb931d000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4bb85d8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4bb9416000)

showed libfontconfig.so was missing. installing that package fixed it and I can pushImage to tag now