XFS CEN not update printer status of ATM - xfs

I want to get the ATM journal printer status using WFSGetInfo() XF API function.
It returns status but it is not updated.
HRESULT resultExec= WFSGetInfo( hSer,WFS_INF_PTR_STATUS,NULL,WFS_INDEFINITE_WAIT,&lp);
printf("\n Printer Result DeviceAsync===> %d \n", ((LPWFSPTRSTATUS)lp->lpBuffer)->fwDevice);
switch(((LPWFSPTRSTATUS)lp->lpBuffer)->fwDevice)
{
case WFS_PTR_DEVONLINE :
printf("\n Printer result WFS_PTR_DEVONLINE : The device is online. \n");
break;
case WFS_STAT_DEVHWERROR:
printf("\n Printer result WFS_STAT_DEVHWERROR : The device is inoperable due to a hardware error.\n");
break;
case WFS_PTR_DEVNODEVICE:
printf("\n Printer result WFS_PTR_DEVNODEVICE : There is no device intended to be there; e.g. this type of self service machine does not contain such a device or it is internally not configured.\n");
break;
case WFS_PTR_DEVOFFLINE:
printf("\n Printer result WFS_PTR_DEVOFFLINE : The device is offline \n");
break;
case WFS_PTR_DEVPOWEROFF :
printf("\n Printer result WFS_PTR_DEVPOWEROFF : The device is powered off or physically not connected.\n");
break;
case WFS_PTR_DEVUSERERROR :
printf("\n Printer result WFS_PTR_DEVUSERERROR : The device is present but a person is preventing proper device operation.\n");
break;
case WFS_PTR_DEVBUSY :
printf("\n Printer result WFS_PTR_DEVBUSY : The device is busy and unable to process an execute command at this time.\n");
break;
case WFS_PTR_DEVFRAUDATTEMPT:
printf("\n Printer result WFS_PTR_DEVFRAUDATTEMPT : The device is present but is inoperable because it has detected a fraud attempt.\n");
break;
case WFS_PTR_DEVPOTENTIALFRAUD:
printf("\n Printer result WFS_PTR_DEVPOTENTIALFRAUD : The device has detected a potential fraud attempt and is capable of remaining in service. In this case the application should make the decision as to whether to take the device offline.\n");
break;
}
Anyone know why?

Related

How do I create an Inter App MIDI In port

I will program an inter App MIDI In Port in my Arranger App, that can be accessed by other MIDI App's. I would appreciate very much to get some sample code. I built a virtual MIDI In port like this, but how to make it visible for other App's:
MIDIClientRef virtualMidi;
result = MIDIClientCreate(CFSTR("Virtual Client"), MyMIDINotifyProc, NULL, &virtualMidi);
You need to use MIDIDestinationCreate, which will be visible to other MIDI Clients. You need to provide a MIDIReadProc callback that will be notified when a MIDI event arrives to your MIDI Destination. You may create another MIDI Input Port as well, with the same callback, that you can connect yourself from within your own program to an external MIDI Source.
Here is an example (in C++):
void internalCreate(CFStringRef name)
{
OSStatus result = noErr;
result = MIDIClientCreate( name , nullptr, nullptr, &m_client );
if (result != noErr) {
qDebug() << "MIDIClientCreate() err:" << result;
return;
}
result = MIDIDestinationCreate ( m_client, name, MacMIDIReadProc, (void*) this, &m_endpoint );
if (result != noErr) {
qDebug() << "MIDIDestinationCreate() err:" << result;
return;
}
result = MIDIInputPortCreate( m_client, name, MacMIDIReadProc, (void *) this, &m_port );
if (result != noErr) {
qDebug() << "MIDIInputPortCreate() error:" << result;
return;
}
}
Another example, in ObjectiveC from symplesynth
- (id)initWithName:(NSString*)newName
{
PYMIDIManager* manager = [PYMIDIManager sharedInstance];
MIDIEndpointRef newEndpoint;
OSStatus error;
SInt32 newUniqueID;
// This makes sure that we don't get notified about this endpoint until after
// we're done creating it.
[manager disableNotifications];
MIDIDestinationCreate ([manager midiClientRef], (CFStringRef)newName, midiReadProc, self, &newEndpoint);
// This code works around a bug in OS X 10.1 that causes
// new sources/destinations to be created without unique IDs.
error = MIDIObjectGetIntegerProperty (newEndpoint, kMIDIPropertyUniqueID, &newUniqueID);
if (error == kMIDIUnknownProperty) {
newUniqueID = PYMIDIAllocateUniqueID();
MIDIObjectSetIntegerProperty (newEndpoint, kMIDIPropertyUniqueID, newUniqueID);
}
MIDIObjectSetIntegerProperty (newEndpoint, CFSTR("PYMIDIOwnerPID"), [[NSProcessInfo processInfo] processIdentifier]);
[manager enableNotifications];
self = [super initWithMIDIEndpointRef:newEndpoint];
ioIsRunning = NO;
return self;
}
Ports can't be discovered from the API, but sources and destinations can. You want to create a MIDISource or MIDIDestination so that MIDI clients can call MIDIGetNumberOfDestinations/MIDIGetDestination or MIDIGetNumberOfSources/MIDIGetSource and discover it.
FYI, there is no need to do what you are planning to do on macOS because the IAC driver already does it. If this is for iOS, these are the steps to follow:
Create at least one MIDI Client.
Create a MIDIInputPort with a read block for I/O.
Use MIDIPortConnectSource to attach the input port to every MIDI Source of interest.
[From now, every MIDI message received by the source will come to your read block.]
If you want to resend this data to a different destination, you'll need to have created a MIDIOutputPort as well. Use MIDISend with that port to the desired MIDI Destination.

Faulty Arduino Logic?

I am making a simple Led program that will be turned into a library for my project. I have created four methods that will allow you to A) Setup as many Led pins as you want and make them as Outputs. B) Flash the Led lights at a customized time. C) Turn On Leds. D) Turn Off Leds. Everything is working if i just run the methods in the void loop(). For example:
Void loop(){
flashLed(pinNum, 2000);
turnOf(pinNum);
turnOn(pinNum);
}
If i run the above code it works fine, however it keeps looping as its obviously in a loop. So i decided to start the serial com by using Serial.begin(9600) in the setup(), and then testing for the serial com and used a switch case statement in order to appropriately implement these methods. What am i doing wrong here? i get no errors at all. When i type into the serial monitor nothing happens, i believe my logic is fine but that is why i am here. When anything is typed into the serial monitor, the code runs the default in the switch case statement and that is all. I have tried using while, if to no avail. Also tested the inverse of serial which would be !serial.available() Here is my code:
//Define the pin numbers
byte pinNum[] = {4, 3, 2};
void setup() {
//Setup the ledPins
ledSetup(pinNum);
Serial.begin(9600);
}
void loop() {
while(Serial.available() > 0){
//Read the incoming byte
byte ledStatus = Serial.read();
switch (ledStatus){
case 0:
turnOff(pinNum);
Serial.println("The Leds Have Been Turned Off");
break;
case 1:
turnOn(pinNum);
Serial.println("The Leds Have Been Turned On");
break;
case 2:
flashLed(pinNum, 1000); //This will make the Led blink for half a second
Serial.println("The Leds Will Begin Flashing");
break;
default:
flashLed(pinNum, 1000); //This will make the Led blink for half a second
break;
}
}
}
//Method to declare the pins as output
void ledSetup(byte ledPins[]){
for (int i = 0; i <= sizeof(ledPins); i++){
pinMode(ledPins[i], OUTPUT);
}
}
//Method to blink the Led light/lights
void flashLed(byte ledBlink[], int duration){
//Time is divided by two because it takes 2 seconds
//to run the sketch
for (int i = 0; i <= sizeof(ledBlink); i++){
digitalWrite(ledBlink[i], HIGH);
delay(duration/2);
digitalWrite(ledBlink[i], LOW);
delay(duration/2);
}
}
//Method to turn Leds off
void turnOff(byte ledOff[]){
for(int i = 0; i <= sizeof(ledOff); i++){
digitalWrite(ledOff[i], LOW);
}
}
//Method to turn Leds On
void turnOn(byte turnOn[]){
for (int i = 0; i <= sizeof(turnOn); i ++){
digitalWrite(turnOn[i], HIGH);
}
}
The serial monitor sends symbols encoded in the ASCII format.
e.g. when you enter 0, Serial.read() returns 48, which is the ASCII code for digit 0. Since the value 48 is not listed in the following cases, the default branch is taken:
case 0: ...
case 1: ...
case 2: ...
default: ...
There are many solutions to your problem.
1. change case conditions to match what you are sending:
case '0': ...
case '1': ...
case '2': ...
2. replace Serial.read() with Serial.parseInt():
int ledStatus = Serial.parseInt();
This will actually work with more general inputs, e.g. 123, but it will return 0 if there is anything different from a digit in the input buffer.
3. wrap Serial.read() within atoi():
byte ledStatus = atoi(Serial.read());
This is somewhat more limited than both of previous options, since now you can only have 10 cases in your switch.

How to open Star Micronics mPOP cash drawer using code

I just received my mPOP device with printer ands cash drawer and I wanted to try and write a simple app to just open the cash drawer and write a log when it was opened and again when closed. I cannot find any easy documentation how to do this.
Can someone please help with the minimum code snippet to open the cash drawer and how to detect it was opened or closed?
The drive drawer command is ESC * r D [0|1|2|3] null, you can find it in the Command Specifications manual. The programming documentation can be found in the document StarIO_POSPrinter_iOS_SDK.pdf. Both documents can be found in the Star Micronics Developers Section. The following snippet is taken from the second manual.
Byte #5 in the command[] array on line 1 of the snippet defines which drive should be activated, possible is 0x00 (none), 0x01 (drive 1), 0x02 (drive 2) and 0x03 (both drives).
This is as far as I get without testing, but maybe you find your way from there.
unsigned char command[] = {0x1B, 0x2A, 0x72, 0x44, 0x01, 0x00};
uint bytesWritten = 0;
StarPrinterStatus_2 starPrinterStatus;
SMPort *port = nil;
#try
{
port = [SMPort getPort:#"BT:" :#"" :10000];
//Start checking the completion of printing
[port beginCheckedBlock:&starPrinterStatus :2];
if (starPrinterStatus.offline == SM_TRUE)
{
//There was an error writing to the port
}
while (bytesWritten < sizeof (command)) {
bytesWritten += [port writePort: command : bytesWritten : sizeof (command) - bytesWritten];
}
//End checking the completion of printing
[port endCheckedBlock:&starPrinterStatus :2];
if (starPrinterStatus.offline == SM_TRUE)
{
//There was an error writing to the port
}
}
#catch (PortException)
{
//There was an error writing to the port
}
#finally
{
[SMPort releasePort:port];
}

GStreamer demo deosn't work in Virtual Machine (seeking simple example)

I am tryign to code an extremely simple GStreamer app. It doesn't matter what it does, so long as GStreamer does something. Even just displaying some text or a simple JPEG would be fine.
Below is about the best example that I could find by Googling (I have added a few error checks). When I run it in a Linux Virtual Machine running under Windows, I see this console message:
libEGL warning: pci id for fd 4: 80ee:beef, driver (null)
libEGL warning: DRI2: failed to open vboxvideo (search paths
/usr/lib/i386-linux-gnu/dri:${ORIGIN}/dri:/usr/lib/dri)
Googling indicates that this is an error with 3D rendering inside a virtual machine. I can find no solution.
So, can someone fix the code below so that it will run in a VM? I assume that that would mean avoiding 3D rendering, so maybe display an image or some text? It is not necessary to play video, this is just a simple proof of concept of using GStreamer inside something else (which has to be running in a VM).
Here's the code ...
void GstreamerPlayVideo()
{
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
int argc;
GError *error = NULL;
/* Initialize GStreamer */
if (gst_init_check(&argc, NULL, &error) == TRUE)
{
/* Build the pipeline */
// Change URL to test failure
pipeline = gst_parse_launch ("bin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", &error);
//// pipeline = gst_parse_launch ("bin uri=http://tecfa.unige.ch/guides/x3d/www.web3d.org/x3d/content/examples/HelloWorld.gif", &error);
if (pipeline != NULL)
{
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* wait until it's up and running or failed */
if (gst_element_get_state (pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
{
g_error ("GST failed to go into PLAYING state");
exit(1);
}
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
if (bus != NULL)
{
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Parse message */
if (msg != NULL)
{
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg))
{
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &error, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), error->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
g_clear_error (&error);
g_free (debug_info);
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
break;
default:
/* We should not reach here because we only asked for ERRORs and EOS */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
/* Free resources */
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
else
{
g_print ("GST get bus error: %s\n", error->message);
exit(1);
}
}
else
{
g_print ("GST parse error: %s\n", error->message);
exit(1);
}
}
else
{
g_print ("GST init error: %s\n", error->message);
exit(1);
}
} // GstreamerPlayVideo()
Try specifying a video sink by hand in your pipeline.
videotestsrc ! ximagesink
Your system may have an EGL video sink plugin installed as the primary video plugin. ximagesink seems a little more likely to work.
Like this:
//this line is where you're creating your pipeline
pipeline = gst_parse_launch ("videotestsrc ! ximagesink", &error);
I recommend experimenting with the gst-launch command first so you can get a hang of pipeline syntax, what sinks and sources are, etc. The simplest test you can run is something like this (if you have gstreamer 1.0 installed, you may have 0.10), from the command line:
gst-launch-1.0 videotestsrc ! autovideosink

Modifying a Kernel Space Function in openSUSE-11.3

I have been working on a K-space USB driver for learning purposes.
As far as I have studied the Kernel Space Source files that are included during the time when the USB driver is performing its routines, I have found announce_devices() is the function which prints the information of the all USB devices connected over the bus.
I plugged in a USB device (a BeagleBoard-xM, in which I have set Product ID and Vendor ID and other descriptors and all of them are verified in User-Space using libusb code), started the computer. When I did a dmesg, I was expecting to see my device. But it didn't show up. Then I ran the libusb code that I have written, it shows the device.
Due to this, I assume that my device is being enumerated normally.
Question #1: If the libusb code is working perfectly alright, that must be going wrong with the module that I have inserted, right? The code is shared below. (This code is taken as an answer in Stack Overflow question Programmatically obtaining the vendor ID, product ID of a USB device on a Linux platform I had written back in January, and it worked fine then). So is my driver working fine? I have rebuild the kernel a number of times (for a number of dynamic modules) after implementing the above code.
Question #2: Can I modify the Kernel-Space function announce_devices() and rebuild the kernel on my machine and verify?
P.S.: Necessary inclusions have been made.
Having gone through almost all the necessary header files, I know that I should be (and I was last time around ) able to access the vendor ID, product ID, and manufacturer details of the USB device through a structure: struct usb_device{} which has a member struct usb_device_descriptor{}. This nested structure has idVendor, idProduct and iManufacturer and some other members.
//*******************************************
struct usb_device udev;
struct usb_bus *bus;
ssize_t ret;
static int __init usb_fun_init (void)
{
int result;
__le16 idVendor = 0;
__le16 idProduct = 0;
__u8 iManufacturer = 0;
__u8 iSerialNumber = 0;
printk(KERN_INFO "\n************************************ in init\n");
list_for_each_entry(bus, &usb_bus_list, bus_list)
{
printk(KERN_INFO "***************** Begins ****************");
printk(KERN_INFO "Vendor ID = %x", bus->root_hub->descriptor.idVendor);
printk(KERN_INFO "Product ID = %x", bus->root_hub->descriptor.idProduct);
printk(KERN_INFO "Serial Number = %x", bus->root_hub->descriptor.iSerialNumber);
//printk(KERN_INFO "Manu = %s", bus->root_hub->descriptor.iManufacturer);
printk(KERN_INFO "Manu = %s", bus->root_hub->manufacturer);
printk(KERN_INFO "Product = %s", bus->root_hub->product);
printk(KERN_INFO "Serial Number = %s", bus->root_hub->serial);
printk(KERN_INFO "\nManufacturer = %s", udev.bus.iManufacturer);
}
return 0;
}
static void __exit usb_fun_exit (void)
{
printk(KERN_INFO "\n************************************ in exit\n");
}
module_init(usb_fun_init);
module_exit(usb_fun_exit);
MODULE_LICENSE("GPL");