How to discover onvif cam in nodejs - node.js

i am trying to use the probe function in nodejs to discover ONVIF cam and it doesn't work.
when i am looking in the wireshark i can't find any broadcast message sending from my computer.
here is the code:
var onvif = require('onvif');
onvif.Discovery.on('device', function(cam){
// function will be called as soon as NVT responses
logger.info("SensorAutoDiscover find camera: " + cam.hostname);
});
onvif.Discovery.probe();

Yesterday I've changed SOAP message for onvif.Discovery.probe method because a lot of cameras wont response on old message. Please try new version from github: npm install https://github.com/agsh/onvif.git and let me know your results.

Related

Pubnub AccessDeniedException . errorData=PNErrorData(information=null

I am having issues with PubNub when subscribing. This is bit random. Works well 90% time on emulator. But fails most of the time on an actual device:
var pubnub = new PubNub(pnConfiguration);
addListener()
pubnub.subscribe()
.channels(Arrays.asList(pubnubChannelId))
.execute();
Error :
PNStatus(category=PNAccessDeniedCategory,
errorData=PNErrorData(information=null,
throwable=com.pubnub.api.PubNubException),
error=true, statusCode=403,
operation=PNSubscribeOperation, tlsEnabled=true .....
I have enabled verbose logs in PubNub Configuration. I am at total loss trying to understand this error messages.
Where do I start debugging this ? same code works most of the time on emulator but on a physical device ?
appreciate any pointers.
Thanks
replacing the character + with another one is a workaround. Pubnub will post an official build soon.

How do I roll-back a message to Amazon MQ (AMQ) from Lambda?

So, I assume this relates to any Node.js and Active MQ installation but I am using Amazon MQ with Node.js Lambda...
Kind of a noob on ActiveMQ so please correct me where I am wrong!
After reading a message from a queue using stompit I continue processing the message and it shall then be sent over HTTPS to another server.
There is some message validation and enrichment happening on the way to the HTTPS POST, and of course the POST itself can result in an error.
How would I (best) handle a roll-back of the message in case of an error:
1) Keep the connection open and not send client.ack() until I finally got a HTTP 200 back from remote server?
2) Keep the message in a variable and put it back in case of error (sequence doesn't matter?
3) Use something other than stomp?
It is apparently not possible using STOMP so I've changed the code to use the library ampq10 instead.
import amqp10 from 'amqp10';
const AMQPClient = amqp10.Client;
const amqpClient = new AMQPClient({
receiverLink: {
attach: {
rcvSettleMode: amqp10.Constants.receiverSettleMode.settleOnDisposition
},
creditQuantum: 1
}
});
This will allow you to do a receiver.accept(message); if successfully handling the message. If you just .disconnect() whitout an .accept() the message will not be removed from the queue.

google-cloud-pubsubTypeError: state.topic.publish is not a function

This is image from node red in terminal
I am working in the sphere of IoT, and want to push message to Pub/Sub in Google, but every time when I run my node-Red, I've got the following error:
25 Dec 18:40:49 - [error] [google-cloud-pubsub out:b2451409.071148] TypeError: state.topic.publish is not a function*
As a source code, I used pub/sub contribution in github, link:
https://github.com/GoogleCloudPlatform/node-red-contrib-google-cloud/blob/master/pubsub.js
It seems that code works fine with credentials and it does create new-topic in Google,in the case, when topic is not present in the cloud, however the message is not published to the topic. In the case of repeating messages in particular interval, the problem above is arising.
Does anyone know how to solve this problem?
I think you've been using an older version of the pubsub API:
const topic = pubsub.topic('YOUR-TOPIC-NAME')
topic.publish(yourData, callback)
The new API as documented here (https://cloud.google.com/pubsub/docs/publisher) looks like this:
const topic = pubsub.topic('YOUR-TOPIC-NAME')
const publisher = topic.publisher()
publisher.publish(dataBuffer, dataJSON, callback)
Hope this fixes your problem.

Stream Audio to Bluetooth Device in C#

I am trying to stream Audio to a bluetooth device in-code in C#. I've picked up the 32feet.net library to help with this. I am able to get a bluetooth speaker paired just fine, and then I use the code below to connect to the device.
globalClient.BeginConnect(device.DeviceAddress, BluetoothService.SerialPort, new AsyncCallback(BluetoothConnectedAsyncHandler), device);
Async Callback method:
private void BluetoothConnectedAsyncHandler(IAsyncResult result)
{
BluetoothDeviceInfo connectedDevice = (BluetoothDeviceInfo)result.AsyncState;
globalClient.EndConnect(result);
if (result.IsCompleted)
{
NetworkStream btStream = globalClient.GetStream();
}
}
This all works well, but when I try to set the service from BluetoothService.SerialPort to BluetoothService.AudioSource, then I receive a SocketException on the "globalClient.EndConnect(result);" line saying "A socket operation failed because the destination host was down". See screenshot:
I've also tried to throw data at the speaker through the NetworkStream when it is setup with BluetoothService.SerialPort, but it doesn't play anything - no noise or static.
My running hypothesis is that this can't be done easily with 32feet.net, and I would have to code up the a2dp spec in code. I think the 32feet.net library is used so that I can tell the Operating System to use the speaker as an output device, rather than control audio output in-code as a supported feature.
Please help! Has anyone done this?
Would it even work if I sent an a2dp compliant stream to the device over the BluetoothService.SerialPort connection?
A2DP spec: https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=8236
Thanks for any help!
Update:
This isn't possible within the 32feet.net library, you can only set the device up to talk the the Microsoft audio service using the setService method call in 32feet.net
www.nudoq.org/#!/Packages/32feet.NET/InTheHand.Net.Personal/MicrosoftSdpService/M/SetService
This MS service manages the A2DP output to the device. There is no way to directly output audio from code into the Bluetooth Device using this library in C#.

Meteor: “Failed to receive keepalive! Exiting.”

I'm working on a project which uses Npm request package for making request to an API server. On getting response, the callback processes the returned response. During this response processing I get the error: Failed to receive keepalive! Exiting. The following code will help you understand.
request({url: 'http://api-link-from-where-data-is-to-be-fetched'
},
function (err,res,body) {
//The code for processing response
}
Anybody can help me please who knows how to resolve this issue?
This might help answer this for you:
https://github.com/meteor/meteor/issues/1302
The last post on that page says:
Note that this is just a behavior of the develop-mode meteor run (and any hosting environment that chooses to turn on the keepalive option, which probably isn't most of them), not a production issue. And in any case, if your Node process is churning CPU for seconds, it's not going to be able to respond to any network traffic.
this post might help you : Meteor error message: "Failed to receive keepalive! Exiting."
Removing autopublish with meteor remove autopublish and then writing my own publish and subscribe functions fixed the problem.

Resources