agsh / onvif

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

My camera: topicSet -> videoSource #241

Open GrumpyMeow opened 1 year ago

GrumpyMeow commented 1 year ago

Hi, I'm just trying to connect with my cheap-ass-security-camera using your package. This partially succeeds. So thank you for your package!

I'm using the code 'example6.js'. I see that that the call parseNode(data.topicSet, '') does not succeed as my camera does not return "topicSet". If i do console.log(data), i see the following object:

{
  videoSource: { motionAlarm: { '$': [Object], messageDescription: [Object] } }
}

console.log(JSON.stringify(data)); gives:

{
  "videoSource":{
    "motionAlarm":{
      "$":{
        "wstop:topic":true
      },
      "messageDescription":{
        "$":{"IsProperty":true},
        "source":{"simpleItemDescription":{"$":{"Name":"VideoSourceToken","Type":"tt:ReferenceToken"}}},
        "data":{"simpleItemDescription":{"$":{"Name":"State","Type":"xsd:boolean"}}}
      }
    }
  } 
}

If i change the code to parse both nodes:

  parseNode(data.topicSet, '')
  parseNode(data.videoSource, '');

I see in the output:

Found Event - /MOTIONALARM
  Source={"simpleItemDescription":{"$":{"Name":"VideoSourceToken","Type":"tt:ReferenceToken"}}}
  Data={"simpleItemDescription":{"$":{"Name":"State","Type":"xsd:boolean"}}}
Subscribed to events

type: let receveUrl => let receiveUrl