Monitor cashdrawer opened or not using EPSON printer in C# - c#

We have Point of sale application.
We don't want to start the billing while the cash-drawer is open.
I saw EPSON is having the "Auto Status Back" function.
I have installed the "OPOS for dotnet" from the EPSON website.
It does open the cash drawer and prints to the printer.
But when it comes to "cash-drawer open/close status", it is always returning false.
The sample C# application is provided by EPSON, has OnStatusUpdateEvent event.
It is firing when I open the printer cover, power on/off. But not firing when the cash-drawer is open/close.
I have tried this sample code using ESC-POS.
Here also am getting "IsCashDrawerOpen = false" always.
{
"IsWaitingForOnlineRecovery":false,
"IsPaperCurrentlyFeeding":false,
"IsPaperFeedButtonPushed":false,
"IsPrinterOnline":true,
"IsCashDrawerOpen":false,
"IsCoverOpen":false,
"IsPaperLow":false,
"IsPaperOut":false,
"IsInErrorState":false,
"DidRecoverableErrorOccur":false,
"DidUnrecoverableErrorOccur":false,
"DidAutocutterErrorOccur":false,
"DidRecoverableNonAutocutterErrorOccur":false,
"DeviceConnectionTimeout":false
}
The printer model is EPSON TM-T82(Connected Via USB).
The cash-drawer is connected via an RJ11 cable connected to the printer.
Can anyone help?

The "Auto Status Back" function is automatically processed inside the OPOS or POS for.NET service object and is not visible to the application.
For "It is firing when I open the printer cover, power on/off.", It is possible that PowerState Online/Offline is notified instead of Open/Close of the CashDrawer.
Please check the value of the status property of StatusUpdateEventArgs.
For "But not firing when the cashdrawer is open/close.", The open state sensor of the CashDrawer may not exist, is not connected, or may be broken. Or the setting by Setup POS (Which is Open state, LOW or HIGH?) May be different.
Are the CashDrawer and connection cable EPSON's? If it is from another manufacturer, is it listed in information such as EPSON's confirmed operation list? Please check it.
By the way, OPOS and ESC-POS-.NET are separate and independent, and there will be little information that can be complemented by arranging them side by side.
You can find the connector wiring diagram on page 68 of the document that you can download from this page.
TM-T82 (Singapore & India Model) Technical Reference Guide
Is it supported and connected?
Or, since the previous page describes the buzzer unit that connects to the drawer kick connector, it may be set to the mode to connect this unit.
Please refer to the setting description starting on page 54 to check.

Related

OPOS Configuration.xml DevicePath Property

We use a windows iot version to do a cash drawer Service Object of OPOS.
We open the cash drawer using GPIO pin,so we communication with system
using Physical Memory address to do a open
We don't know how to set a Hardware Device Path of Configuration file of POS.NET
environment.
Someone could help us to deal with the Hardware Device Path problem?
<Device HardwarePath="0xFED0C1D8" Enabled="yes" PnP="no">
<LogicalName Name="WASPCD" />
</Device>
The HardwarePath="0xFED0C1D8" is our GPIO address ,is that right?
If the cash drawer service object you are using is made by OPOS instead of POS for.NET, you do not need to write the configuration.xml of POS for.NET.
Please make sure that Common Control Objects are installed.
Follow the procedure below to open the cash drawer device in the application.
2-1.Acquire the device collection by calling the GetDevices method with CashDrawer as the type parameter and Opos or OposAndCompatibilityLevel1 as the compatibility parameter.
2-2. Search the device information with the device name key or logical device name of the device being used defined in the OPOS registry from the acquired device collection, and perform CreateInstance based on it.
2-3. Call Open method using created object.

NI USB-6363 BNC User Access Pins

Does anyone know what the User Access Pins are used for in the USB-6363 device? What type of signal are they supposed to read and what are they capable of doing?
USB-6363 BNC Front Panel
The USB-6363 BNC device is matching the BNC-2120 terminal interface. The "USER" BNC and screw terminals do not connect to the DAQ device, but only to each other and act as convenient patch spots to bring in external signals.
The BNC-2120 Installation Guide (page 13) has more information.

Update Wifi networks programmatically

I'm trying to create program that connects to certain wifi network when it's in range, even if already connected to another wifi.
I'm using SimpleWifi, and basically it works great. Except that it does not see new wifi networks before I clicked wifi icon in Windows 10 taskbar to show list of networks.
How can I force c# program to update wifi network list?
Currently using IEnumerable<AccessPoint> accessPoints = wifi.GetAccessPoints().OrderByDescending(ap => ap.SignalStrength); to update wifi networks, but as I said, it does not see new networks before refreshed manually from Windows.
It's almost 3 years ago but here is my take on this issue anyways.
In that library you can call:
SimpleWifi.Wifi.Disconnect()
Which I do before re-connect and get the list of access points again. This works sort of, new networks introduced after windows discovery does actually show up, but are way slower than if you click "wifi" button in Windows, which will bring up newly discovered networks right away.
If someone knows a solution to "trigger" Windows/Managed wifi connections to update it's list, just like you do in Windows, I would appreciate that
SimpleWifi, like other Wifi libraries have this feature built-in. And its required as Windows does not always show all the wifi networks available correctly, unless queried..
the sample code can be found here: https://pastebin.com/1iCp41SP
, not the most elegant code , but worked in a WPF project.
This part of the code scans/refreshes the Wifi List in SimpleWifi
var testClient = new WlanClient();
foreach (WlanInterface wlanIface in testClient.Interfaces)
{
wlanIface.Scan();
}

Obtaining the IP and MAC of client machines connecting to my ASP.NET MVC application on a server

I have just signed up because I need some clarification. I am an old man but a new graduate of a Systems Analysis college program and am on my first "real" job designing a system for a local company. Here is the deal. I am using ASP.NET MVC. Now, the company has assembly lines in a large manufacturing plant. Along the lines are stations where workers do a specific job on the line. The company has paper instructions that explain to the worker step by step how to do the job at their station. They want all this done electronically now....this is what I 'm doing.
So, when the leader of the assembly line starts their shift, they log into the system by opening up IE and connecting to the application server. From there, the leader picks a part to "make" on the line. The system then goes into the repository of instruction documents and retrieves all the documents needed by each station on the line to run the selected part. The system then needs to prepare the documents according to the station that will use them (ie. station 1 docs, station 2 docs,....etc). Then, the system needs to automatically open up the IE browser window on the client machine at each station on the line and display the login screen. The worker then logs onto the station and is presented with the "dashboard" screen with the instruction forms right there in front of him with buttons to navigate through the various docs for his station.
So now, we are wanting to have the system store the IP and Mac addresses of each station machine along each assembly line in a table along with fields that denote the assembly line and station # (ie. so a row in the table would have MAC | IP | ASSEMBLYLINE-ID | STATION-ID). This table will be populated before hand by admins so that the system knows already what the Mac and IP are for each machine on the floor. So, when the leader picks a part to run, the system can just check the machine the leader is logged into and get its MAC and IP and then look up in the table what line the machine is on. Then it can create a document queue for each station on the line, and then when the queues are ready, it can look in the table for the IP's of each machine on the line so that it can open the log on screen on the right machines.
However, it is possible that IP's may change from time to time. For this reason, we want to make sure we also use MAC addresses to validate the identity of a station machine whenever any communication needs to happen between the system and the clients. IP's alone just aren't good enough. Further, we are using all zero clients for this on the stations.
So, if you're still reading, lol. How can my system on the server, run a getMAC command on a machine that connects to it?
A web server cannot get the MAC address of a client machine. MAC addresses are stored on the physical ethernet layer and are not routed through socket connections. A MAC address stored in a packet is changed on every hop of a packet's journey. MAC is an abbreviation for Media Access Control, with "Media" referring to the local communication media. While source and destination IP-Addresses remain the same throughout the journey (and are used for long-distance routing decisions), the source and destination MAC-Addresses just indicate the next hop.
That being said, you can get the IP address like so:
Request.UserHostAddress()
However, as you yourself pointed out, this isn't reliable. Especially if the computers are behind a proxy or firewall.
To address your real problem, which is identifying a machine in your assembly line, one method is to get the computer name. You can open a command window and type the command hostname and that will return the computer name. It should be unique for each of your machines. If not, you can set it by right clicking on Computer. To get this name through javascript, use this code:
function GetComputerName()
{
try
{
var network = new ActiveXObject('WScript.Network');
var computerName = network.computerName;
return computerName;
}
catch (e) { }
return "";
}
Note that this code will only with with Internet Explorer and it may require you to enable special security settings inside the browser.

Programmatically enabling Windows 8 Pro mobile broadband device

Background
The company I work on is developing a kiosk-like application for tablets running Windows 8 Pro (on desktop mode). The user shouldn't be able to access anything that isn't the application itself: charms will be disabled, the taskbar will be hidden behind the application, etc.
This also means the user shouldn't be able to change network settings, leaving the responsability to keep the device always connected to us. Up to now, I had success using the Mobile Broadband API to assure the device is connected whenever there's a mobile network available. It'll detect disconnect events and try to connect again.
The Problem
Although the user shouldn't be able to do it, I'm considering the case where the user follows this steps:
User opens right-side charm,
clicks on Settings,
clicks on Network,
clicks on More PC Settings,
clicks on Wireless, and
disables the mobile broadband device.
I would like to be able to revert this programmatically and enable it again.
The Attempts
I have tried some different ways to force 3G being reenabled. Most of them give me the same result: they supposedly enable the device without errors, but I still cannot use it. Enable-NetAdapter in Powershell doesn't throw errors, and the Enable method of Win32_NetworkAdapter appears to work, but no dice.
I thought maybe the method IMbnRadio::SetSoftwareRadioState could be what I'm after, but I can't get to it when the device is disabled. The method IMbnInterfaceManager::GetInterfaces throws a COMException claiming the element could not be found (HRESULT = 0x80070490).
MbnInterfaceManager mbnInterfaceManager = new MbnInterfaceManager();
IMbnInterfaceManager interfaceManager = (IMbnInterfaceManager)mbnInterfaceManager;
// The following line throws a COMException:
IMbnInterface[] interfaces = (IMbnInterface[])interfaceManager.GetInterfaces();
mobileInterface = interfaces[0];
mobileRadio = (IMbnRadio)mobileInterface;
uint requestId;
mobileRadio.SetSoftwareRadioState(MBN_RADIO.MBN_RADIO_ON, out requestId);
Is there a way to override user preferences set on "More PC Settings?"
I found a sketchy way to solve this. Keep in mind this is undocumented, wrong, shameless and immoral, and will probably break eventually. The client is aware of this, but prefers to keep the access to the OS limited.
The setting in case is saved in the Registry. At least in the computers I've checked, it's stored in HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0022 in a key named RadioOff.
The Airplane Mode setting is also stored in the Registry, but in a different place. It's at HKLM\SYSTEM\CurrentControlSet\Control\RadioManagement\SystemRadioState in a key named (Default).
After changing these keys and rebooting, everything seems to work fine. I'll repeat though: you really shouldn't be doing this, especially the Airplane Mode thing.

Categories

Resources