Giter Site home page Giter Site logo

reolinkapigo's Issues

Errors unmarshalling device info

When querying an RLC-820A on the latest firmware the response from the camera is that the wifi is 0 and not a boolean false

I have written a fairly ugly function to manage this here - https://github.com/parkervcp/reolinkapigo/blob/update_deviceinfo/internal/pkg/models/system.go#L53

I am not saying it's "the" fix to use but it is "a" fix that works right now. It handles both the int and bool values and errors on any other value.

example data from my camera

{
            "B485" : 0,
            "IOInputNum" : 0,
            "IOOutputNum" : 0,
            "audioNum" : 1,
            "buildDay" : "build 21073001",
            "cfgVer" : "v3.0.0.0",
            "channelNum" : 1,
            "detail" : "IPC_523128M8MPS18E1W01100000001",
            "diskNum" : 1,
            "firmVer" : "v3.0.0.494_21073001",
            "frameworkVer" : 1,
            "hardVer" : "IPC_523128M8MP",
            "model" : "RLC-820A",
            "name" : "Camera1",
            "pakSuffix" : "pak,paks",
            "serial" : "00000000HEIGSDH",
            "type" : "IPC",
            "wifi" : 0
}

example code:

	cam, err := reolink.NewCamera("admin", "", "192.168.10.106")
	if err != nil {
		log.Errorln(err)
	}

	_, err = cam.Login()(cam.RestHandler)
	if err != nil {
		log.Errorln(err)
	}

	camInfo, err := cam.GetDeviceInformation()(cam.RestHandler)
	if err != nil {
		log.Errorln(err)
	}

	log.Printf("%v", camInfo.Name)

error:

2021/11/06 23:20:33 token data unmarshalled &{60d05f1bfa4516b 3600}
2021/11/06 23:20:34 token data unmarshalled &{b1ab49e8c6d468c 3600}
ERRO[0000] json: cannot unmarshal number into Go struct field DeviceInformation.wifi of type bool 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x6432f9]

goroutine 1 [running]:
main.main()
        /home/nvr/test/vnCT5zWjiz/test.go:48 +0x179

RTSP on incorrect stream Crashes application

When the RTSP stream is not of the correct encoding the following error happens:

Fix Format may be raw PCM 97 96

This crashes the whole application instead of just returning the error to be handled correctly.
Gracefully return error instead of crashing application.

NetworkMixin response example data missing

Response example data for GetWifi and ScanWifi is missing.

Currently

wifiInfo, err := camera.API.GetWifi()(camera.RestHandler)

scanWifiInfo, err := camera.API.ScanWifi()(camera.RestHandler)

will return nothing due to the struct being empty.

Login Bug

Bug was caused by auth = false in Request function within RestHandler.
auth is now completely removed due to Login also requiring query parameters to be set even though token is empty.

ImageSettings (image_mixin) enums do not contain all setting options

The ImageSettings have quite a range of options that could be set, however I could not create all the enums for each setting due to not having the range values.

For example:

ok, err := camera.API.SetAdvanceImageSettings(
	api.ImageAdvancedOptionDayNight(enum.DAY_NIGHT_AUTO),
	api.ImageAdvancedOptionBacklight(enum.DYNAMIC_RANGE_CONTROL),
	api.ImageAdvancedOptionBlc(1),
	)(camera.RestHandler)

The enum.DAY_NIGHT_AUTO is the only option I can set currently on DayNight switching due to not knowing the full range.

There are a couple of other enums that have the same problem. will create separate issues for them as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.