reolinkcameraapi / reolinkapigo Goto Github PK
View Code? Open in Web Editor NEWReolink camera api in Go
License: GNU General Public License v3.0
Reolink camera api in Go
License: GNU General Public License v3.0
Code refactor required for optional parameters due to readability.
Going to refactor to use this style: https://github.com/uber-go/guide/blob/master/style.md#functional-options
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
Requires Testing on a live camera for initial release.
Examples of how to implement and use the library are in the examples folder.
https://github.com/ReolinkCameraAPI/reolink-go-api/tree/main/examples
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.
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.
RTSP client is completely disconnected and has no affiliation with the camera object. Refactor so that rtsp client is easier to use from within the camera object.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.