Handheld Scanner with nodejs and OPOS - node.js

I was struggling with this for a couple of days now and Google seem to have no information..
I'm trying to interface a DataLogic-QuickScan-QD2131 scanner using OPOS (under windows 10, RS-232 OPOS interface) with nodejs.
I understood that OPOS uses ActiveX controller to communicate, so i use the winax npm-package to create ActiveXObject reference, but I have no idea what is the "class string" i should provide to the constructor.
Here's my code:
require("winax");
const con = new ActiveXObject("OPOSService.OPOSScanner");
console.log(con);
this will fail with the following error:
Uncaught Error: CreateInstance: OPOSService.OPOSScanner Invalid class string
Thanks guys!

You probably should stop using OPOS from Node.js.
As I answered your other question, the current OPOS only supports 32bit.
If you still want to use it, find and specify the programmatic ID string for the scanner OCX in DataLogic's OPOS.
I don't have any information about what it looks like, so you can find it yourself or contact DataLogic.
As an alternative, obtain and install the Common CO from the following page and specify "OPOS.Scanner" as the programmatic ID.
MCS: OPOS Common Control Objects - Current Version
If you have a combination of Node.js and a barcode scanner in serial port mode, it would be better to send commands and receive barcode data directly from Node.js using the serial port instead of OPOS.

Related

Snap7 + Ni Labwindows/CVI

Hi guys i am working on a project where my client wants to use Siemens S7 1200 to control some pneumatic tools and an interface on labwindows Cvi.
I downloaded SP7 ( snap 7) on a try to communicate with my plc but i found myself blocked since the downloaded file contains only a DLL file and a lib file whit no.h file ( header file )
could anyone tell me how to use snap 7 properly on labwindows ?
thanks
AFAIK if you want to use Snap7, you'll have to download the source (C++) and then manipulate it to work with LabWindows.
S7-1200s also have the following communication options.
Free-of-charge:
Modbus/TCP
Socket services ("Open user communication")
MQTT unencrypted
For a fee:
OPC UA
More here:
Communication methods for S7-1200/1500 PLCs
Personal opinion: if you don't have many data points to monitor, I would go with Modbus/TCP.

UWP - Serial Port over bluetooth on Xamarin forms

I'm trying to connect to fiscal printer using serial port in xamarin.forms application.
I managed to make it work on android, but I have some troubles with UWP.
I am currently testing it on desktop if it matters.
await DeviceInformation.FindAllAsync() - this line never returns, no matter whether I call it with selector or not.
var sel = SerialDevice.GetDeviceSelector("COM7");
var coll = await DeviceInformation.FindAllAsync(sel);
It just hangs. Anybody knows how to use FindAllSync / has a similar problem? I've found some examples on the web, but they do not seem to work, the method always hangs for me.
I also tried to use a different approach and use devicewatcher, I was able to get the list of all devices and the bluetoothdevice object, however I couldn't create a serialport for it.

Connect Wifi in MS Universal windows app?

We know an iOS app can connect to Wifi with CaptiveNetwork reference. As described in some related post: Connect WiFi Network via App.
Is there any similar library to help a Windows app to view exising wifi around and get connected?
Yes. There's the Windows.Devices.Wifi namespace. (Details here https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.wifi.aspx?f=255&MSPPError=-2147217396 )
It offers Methods to list networks and a method called ConnectAsync() to connect. I once coded a sample here (it also covers other stuff): https://github.com/DanielMeixner/w10demoking/blob/master/Windows10DemoKing/wifi.xaml.cs
The magic lines of code are
using Windows.Devices.WiFi;
// create network adatper instance (see sample code in link above) ...
var nw = nwAdapter.NetworkReport.AvailableNetworks.Where(y => y.Ssid.ToLower() == "myssid").FirstOrDefault();
await nwAdapter.ConnectAsync(nw, WiFiReconnectionKind.Automatic);

finding location in codename1

I'm following this tutorial for finding locations on my j2me device. In the default codename1 mechanism, it tries to find it out through GPS. But my phone doesn't have it. So it opens the bluetooth connect screen. I'm using the following code.
com.codename1.location.LocationManager.getLocationManager().getCurrentLocationSync();
In the tutorial mentioned, we could change the retrieval mechanism to CELL-ID or Network, by doing the following.
//Specify the retrieval method to Online/Cell-ID
int[] methods = {(Location.MTA_ASSISTED | Location.MTE_CELLID | Location.MTE_SHORTRANGE | Location.MTY_NETWORKBASED)};
// Retrieve the location provider
provider = LocationUtil.getLocationProvider(methods, null);
Is there any way we could do a similar stuff in codename1 ??
We don't support other methods in J2ME devices at this point in time. You can use native interfaces to implement it.

Using ActiveX Com Components with nodejs. Is it possible

Is there a way to use any ActiveX com components with nodejs?
Actually, I would never need this but I'm running nodejs on Windows and trying to send ping requests without forking new processes (no such module exists for Windows).
As some Activex components exist for sending ping requests with raw sockets, maybe I can use them.
An example of how you can create a COM object from JavaScript is:
var rs = new ActiveXObject("ADODB.Recordset");
There is node-win32ole ( npm install win32ole ).
EDIT: win32ole is no longer actively maintained. You could try winax instead.
(updated)
You could try to use node-ffi to bind to Win32 and launch a COM/ActiveX component (CoCreateInstance) or access winsock/icmp directly. See https://github.com/rbranson/node-ffi
Or try to ping via WMI, e.g. "select * from win32_pingstatus where Address='...'". See https://npmjs.org/package/wmi
An ICMP ping module for Node.js now exists:
https://npmjs.org/package/net-ping
Years later:
node winax
node win32ole no longer works with up to date node.js versions

Resources