Hello lovely community!
I am using a HP 2x20 Integrated Display with HP RP 7800 Retail System and decided to play with it and write some small programs for it to learn coding.
The sample tool provided with the SDK works perfectly.
First I wrote a simple program using Microsoft.IO.Ports and simple functions like this:
SerialPort COM3 = new SerialPort("COM3", 9600, Parity.None, 8);
COM3.Open();
COM3.Write(Clear); // string Clear = "\x1B\x40" - hex value of a control character for the display
COM3.Write("Hello community");
It actually worked okay but I didnt manage to apply some of the control characters provided from HP manual and therefore I decided to move on to POS for .NET.
So now straight to the point. I wrote a C# program with basic functionality and buttons.
using Microsoft.PointOfService;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
LineDisplay lineDisplay;
PosExplorer explorer;
public Form1()
{
InitializeComponent();
try
{
explorer = new PosExplorer(this);
DeviceCollection devColl = explorer.GetDevices(DeviceType.LineDisplay); // is this line the problem?
//DeviceCollection devColl = explorer.GetDevice("LineDisplay", "HPLCM220Display"); // this one shows errors so I couldnt use it instead of the line above
if (devColl == null || devColl.Count <= 0)
{
MessageBox.Show("Device not found");
return;
}
lineDisplay = (LineDisplay)explorer.CreateInstance(devColl[0]);
lineDisplay.Open();
lineDisplay.Claim(10000);
lineDisplay.DeviceEnabled = true;
lineDisplay.DisplayText("Hello World.!");
lineDisplay.DisplayTextAt(1, 0, "Hey MSDN");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
private void btn_Clear_Click(object sender, EventArgs e)
{
lineDisplay.ClearText();
}
private void btn_SendText_Click(object sender, EventArgs e)
{
lineDisplay.DisplayText(textBox1.Text);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
//this.textBox1.TextChanged -= textBox1_TextChanged;
}
}
}
And when I launch it it shows me a LineDisplay Simulator which can be cleared and the text can be altered, but the real display doesnt even show anything or gets cleared.
So the question is: how do I make my app show text on my display instead of the simulator. Debugging doesnt really help me. What I noticed is that in AUTOS it shows Microsoft.PointOfService.DeviceSimulators.LineDisplaySimulator in LineDisplay Value so it somehow usess DeviceSimulators but I dont know how and why..
I used POS for .net documentation but sadly didnt succeed https://msdn.microsoft.com/en-us/library/microsoft.pointofservice.linedisplay(v=winembedded.11).aspx
I assume its somehow around - Device Collection line
DeviceCollection devColl = explorer.GetDevices(DeviceType.LineDisplay);
//DeviceCollection devColl = explorer.GetDevice("LineDisplay", "HPLCM220Display");
but if i use the commented line instead of the first une it shows the error:
Error CS0029 Cannot implicitly convert type 'Microsoft.PointOfService.DeviceInfo' to 'Microsoft.PointOfService.DeviceCollection' WindowsFormsApplication14 C:\Users\admin\Documents\Visual Studio 2015\Projects\WindowsFormsApplication14\WindowsFormsApplication14\Form1.cs 27 Active
I tried to look for a solution to CS0029 but unfortunately I failed at finding any connection to my problem.
Ive never programmed anything so I am a newbie with shitty code but im striving to learn so please if anybody is so kind to shed some light onto this issue I would be very thankful :)