agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
692 stars 234 forks source link

Imaging getOptions removed #197

Closed jwilsoab closed 2 years ago

jwilsoab commented 3 years ago

Is there any reason Cam.getVideoSourceOptions was removed? (Imaging) How does one go about getting range of values for imaging options now?

agsh commented 2 years ago

Wow. This is surprise for me. @RogerHardiman

RogerHardiman commented 2 years ago

Did some checking so need more info from Adam, @jwilsoab

getVideoSourceOptions is not an ONVIF API that I can find in the ONVIF spec (or WSDL) I've checked Media API, Media2 API and Imaging APIs

If the request is to get the ranges of values for Image Sizes, there is an ONVIF API with a slightly different name of getVideoSourceConfigurationOptions in the Media API. But this library has never implemented it. There is another NodeJS ONVIF Library on github that supports it (so their README says).

If the request is to get the range of values for Brightness settings (the ONVIF Imaging API) then the ONVIF command is getOptions in the Imaging API.

So need more info from Adam to get more detail.

Thanks Roger

This library has never implemented that command. I know another common Javascript/Node JS ONVIF library does support it.

The range of options for Imaging is not getVideoSourceOptions. It is Imaging API and GetImageSettings

armlesswunder commented 2 years ago

Hmm, maybe it was added after being pulled. Here's the method I'm talking about:

    /**
     * Get the video source options for a given video source
     * @param {Object} options.token videoSourceToken 
     * @param {function} [callback]
     */
    Cam.prototype.getVideoSourceOptions = function(options, callback) {
        if ( !(options && options.token && callback) ) {
            callback.call(this, 'Invalid arguments given to getVideoSourceOptions');
            return;
        }

        this._request({
            service: 'imaging'
            , body: this._envelopeHeader() +
            `<GetOptions xmlns="http://www.onvif.org/ver20/imaging/wsdl">
                <VideoSourceToken>${options.token}</VideoSourceToken>
            </GetOptions>` + 
            this._envelopeFooter()
        }, function(err, data, xml) {
            if (callback) {
                let jsonData = linerase(data),
                    respData = {};
                if (jsonData && jsonData.getOptionsResponse && jsonData.getOptionsResponse.imagingOptions) {
                    respData = jsonData.getOptionsResponse.imagingOptions;
                }
                // Empty response on success
                callback.call(this, err, respData, xml);
            }
        }.bind(this));
    };
armlesswunder commented 2 years ago

Sorry, this is jwilsoab using a different acct

RogerHardiman commented 2 years ago

That was fast. Thanks. I'm checking the source now.

RogerHardiman commented 2 years ago

There is something weird here. Could you attach here the whole source file that this function came from please and do you know where you got that source from. I am wondering if it was from a fork of the source code.

It just seems odd that we'd have a function called getVideoSourceOptions when the actual ONVIF API is getOptions. Normally the function name matches up with the ONVIF API action.

RogerHardiman commented 2 years ago

Also, could you send the package.json file. That contains the library version too.

Thanks for your help

armlesswunder commented 2 years ago

package.json.txt imaging.js.txt

armlesswunder commented 2 years ago

This chat only supports txt files in chat..., but these are the files we had previously

RogerHardiman commented 2 years ago

hanks for the files. I've checked all the historical versions of imaging.js and the GetOptions function has never been in the Master (release) branch. I wonder where you got that source from. Maybe someone else's fork or another project that uses the library. Anyway, let's get it added.

REQUEST Normally when we add new functions to the library when also include test code in the 'test' folder and put in a simulated ONVIF reply in the test/serverMockup.

I wonder if whoever wrote getVideoSourceOptions also implemented the ServerMockup tests. Could you navigate to the tests/serverMockup folder in your old ONVIF library and do an 'ls' for me please. Then I can see if whoever added getVideoSourceOptions added an implementation of imaging.GetOptions

That would save us a load of work mocking up and testing the function.

Thanks Roger

RogerHardiman commented 2 years ago

I have grabbed the XML reply for GetOptions and added it to the test/serverMockup and added in a test to coffeescript. But, my test is failing so cannot push the changes this evening. Will have another stab at it in a day or two.

Roger

RogerHardiman commented 2 years ago

@jwilsoab @armlesswunder , could you check out the Master branch of the library please and check this works for you. I've taken the code you sent over and included it in the ONVIF library along with unit test changes in the /test folder.

The API will be the same, but I made one change to do with how Options parameter is parsed to make it consistent with other functions and code changes.

Let me know if it works fine. I've tested it against a Bosch camera and get the JSON data structure back with the max and min and included it in the test scripts.

Roger

armlesswunder commented 2 years ago

@RogerHardiman yes that works for me. Thanks again for your help!

RogerHardiman commented 2 years ago

That is great. Thanks for the report.

Are you able to share anything about the project you are working on, always nice to hear how the library is used.

armlesswunder commented 2 years ago

@RogerHardiman Yes, I work for a VMS solution called Cloudvue. https://www.cloudvue.io/

I write camera integration scripts using Node.js and I also do mobile development of Cloudvue and Cloudvue Access apps.

We support many ONVIF Profile S Cameras with help from this repo to do things like RTSP streaming, PTZ controls, modify imaging settings, OSD settings, Scan for ONVIF devices, etc...

I really appreciate this repo. Thanks for everything!

RogerHardiman commented 2 years ago

Thanks for the feedback on the library uses. That's really interesting.

Also you mentioned Profile S.

In Release 0.6.5 I added some of the bits of Profile T. Now we can get the RTSPStreamURIs for the H265 streams off Bosch and HikVision cameras. (Back with the Profile S APIs, most cameras only advertised their MJPEG/MPEG4/H264 streams [as 265 was not a valid Profile S codec]. I'm using that on a project with new Bosch cameras and can get the H265 stream URIs back now.