Libraries for .NET or C++

GX and Typhoon hardware, this includes, displays, cables and accessory cards.

Moderator: Mods

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Libraries for .NET or C++

Post by cipher_nemo »

Is there (or will there) be a release of libraries for C++/C# programmers to interface the GX? I'd be interested in purchasing the new GX displays if I can create my own executables for it. LCDStudio is a memory hog, and must be running on each PC that wants to display something on an LCD device.

Logitech released a .NET library for basic interfaces of its G15 keyboard's LCD, which let me run my own applications to coordinate LAN parties. One for the GX series would be greatly appreciated. Thanks.

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

There will be an official SDK with documentation in the future but I am unable to comment on release or target dates on this.

What I can do for you to get you playing with your GX in the mean time is let you use our internal .Net library but do realize this is an internal library which is targeted for a code cleanup so the API may change a little in the future. (But as long as you distribute a copy of the dll with your software this shoudn't be a problem)

I Created a small C# walk through for you.

1) Create a new C# Console Application
2) Add references to System.Drawing.Dll and LibDriverCoreClient.dll (located in the Matrix Orbital folder in program files)
3) Paste the follwing code

Code: Select all

using System;
using System.Collections.Generic;
using System.Text;
using LibDriverCoreClient;
using System.Drawing;
using System.Drawing.Text;
using System.Drawing.Drawing2D;

namespace dcSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Connect to the DriverCore service
            DCClient client = new DCClient();
            client.Connect();
            
            //See if there are any displays connected
            DCCClientDeviceList devices = client.Devices;
            if (devices.Count() > 0)
            {
                //Create a new session
                DCCSession session = devices[0].CreateSession("My Sample Application");
                
                //Create a Surface to draw on in the dimensions of the connected LCD
                Bitmap Surface;                
                session.CreateGraphics(out Surface);

                //Create a Graphics object to draw on the surface.
                Graphics G = Graphics.FromImage(Surface);

                //Disable font smoothing since it does not look good on a 
                //monochrome device.
                G.SmoothingMode = SmoothingMode.None;
                G.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

                Console.WriteLine("Press any key to quit...");
                while (!Console.KeyAvailable)
                {
                    G.Clear(Color.White);
                    G.DrawLine(Pens.Black, 0, 0, Surface.Width, Surface.Height);
                    
                    G.DrawString("Hello World " + DateTime.Now.ToLongTimeString(),
                                 new Font("Arial", 10), 
                                 Brushes.Black, 0, 0);
                    
                    session.SendAsyncFrame(Surface);
                    System.Threading.Thread.Sleep(500);
                }
                //Clean up the session 
                session.End();
            }
            //Disconnect from the DriverCore Service
            client.Disconnect();
        }
    }
}
4) Build and run the example

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

Thank you for the help, Ray! That should make quite a difference for me, and no problem about the internal vs. production library. I will order one next Friday and check it out. Thanks!

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

Ray, thank you again for your help. I just received my GX today, connected it, followed your directions for referencing the GX drivercore in Visual Studio, and ran your simple demo without a single hitch, bug, or difficulty.

Awesome! Now I can get to work writing some apps for the GX. :D
Attachments
dotnet_csharp_mo_gx1.jpg
dotnet_csharp_mo_gx1.jpg (16.98 KiB) Viewed 15834 times

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Enjoy! feel free to show off your progress on them :)

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

When I get to that point, I'll be sure to remember. :D

I do have a questions about the DriverCore. I hope you can answer them for me...
  1. I can set the backlight with a created session, such as: session.SetRGBBacklight(byte r, byte g, byte b), but I doesn't seem like I can read the GX's current backlight setting. Any get property I can reference for it?
  2. I can't set or get the contrast at all from the methods shown for a session. Is this not yet implemented?
  3. It looks like I can work with multiple GX devices at one time, which is great! I only have one device to do my testing, but I assume I can create a session for each device and work with them simultaneously without any glitches?
  4. What's the difference between .SendAsyncFrame and .SendFrame? Is the asynchronous sending of frames buffered or something in the GX's memory? Both seem to work the same for me, but it's not like I'm scrolling text or adding movement yet.
Thanks again for your help! :)

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

cipher_nemo wrote:When I get to that point, I'll be sure to remember. :D
I do have a questions about the DriverCore. I hope you can answer them for me...
I'll be able to answer some of those today, the others have to wait till i'm back at the office tomorrow and take a look at the code my selve, so the ones i don't answer i'll get back to you on.
[*]It looks like I can work with multiple GX devices at one time, which is great! I only have one device to do my testing, but I assume I can create a session for each device and work with them simultaneously without any glitches?
Yes, you can. but always pay attention to the size it reports back, right now it's always 240x64 but in the future this might not always be the case.
[*]What's the difference between .SendAsyncFrame and .SendFrame? Is the asynchronous sending of frames buffered or something in the GX's memory? Both seem to work the same for me, but it's not like I'm scrolling text or adding movement yet.[/list]
Thanks again for your help! :)
Drivercore is basicly dividing the display between multiple applications, each application gets a small timeslot to display its magic, when using SendFrame the function call will not return until the frame you send is 100% guaranteed displayed on the actual device, this sometimes can take 45 seconds if a couple of other application are infront of you displaying stuff.

AsyncFrame however returns as soon as the frame is delivered to the DriverCore service but it might not have been displayed on the actual device.If there are again a couple of aplications in front of you there will be a wait again but when it is your applications turn DriverCore will use the latest frame send to it and discart all previous ones. This basicly allows you to Update the image of your session regardless if it has been displayed or not.

quite usefull for the clock for instance, let say you send "12:34" using SendFrame and there are a whole lot of applications running the function might not return until 12:37. You don't want it to say 12:34 in the first frame and then jump to 12:37 in the next, so you send an async frame every minute and whatever the latest frame says in drivercore it will display.

Both methods have their uses and it's pretty much op to the situation you are in which one is best.

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Ok just verified, the answers to backlight and contrast questions, these are not implemented at the moment so you cannot access them.

For backlight once you set it you can keep track of it your selve, the contrast you are indeed out of luck.

These properties will be added in future versions.

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

Thanks for the fast reply, Ray! No problem, just good to know I wasn't missing something. :)

Will that be included with the released libraries for .NET, in the future? Contrast isn't quite as important even though it is always nice to have. I would like to make a request for some features in the next release if that's ok?

...
  • Access to all LCD information, including properties currently in the LCD's memory from LCD defaults configuration utility.
  • Ability to upload and download bitmaps that appear when the device is powered on, but when the DriverCore isn't connected, much the same way as the LCD defaults configuration utility.
I'm already a very happy camper getting to access the DriverCore in .NET/C#, but this would be icing on the cake. Thanks!

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

The uploading of the splash screen is done using the 'Firmware Upgrade Device' mode of the GX (you might have noticed the GX enumerates as a different usb device when you are doing that) so this is not available when the GX is in 'regular' mode and is being run by DriverCore.

The reading of the backlight and contrast settings will be added though.

The functions used by GXDefaults to get from a color picture to a monochrome one are in FastBitmap.dll i'm fairly sure this will not be documented in the SDK but there's nothing stopping you from messing with them.

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

Is there any way to get the DriverCore to display a bitmap other than the "Display is idle..." message? I can't find a method or property for it, so I assume it doesn't exist (yet?).

When powering down a PC, as we all know, the device is still active and stuck on the last frame generated by the DriverCore before than service is stopped. I can set the backlight value(s) to 0, but the last frame is still shown.

It would be really nice to be able to change DriverCore's idle message to provide some other image when a PC is powered down. The only way I've been able to do this is to stop the DriverCore service (which I can do in code), then run the default configuration utility, 'configure' the device, and set its default bitmap. Unfortunately I can't run the default driver configuration utility to do this in my code. It would be helpful to put something useful up there such as the system's IP address, name on the network, and ownership contact info, etc.

Also...

I know you guys have planned a new version of the firmware to be released in the near future. From what it sounds like, MO plans to address the always powered on by +5vsb issue. I rather like having mine on, especially if I can set its last frame in code, so will there be an option to toggle that setting?

Thanks! You guys rock. :)

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

There is no way to change that right now. The idle message is the default message when there are no clients connected (and indeed unfortunatly gets stuck when the service shutdowns)

DriverCore will be updated to either clear the screen or show the bootscreen when the service shuts down not sure what will be 'wise' yet.

About keeping the unit on as an option in the new firmware i'd have to talk to the engineer incharge of it, but don't get your hopes up on that one.

cipher_nemo
LCD Geek
Posts: 41
Joined: Tue Aug 07, 2007 12:20 pm
Contact:

Post by cipher_nemo »

If worse comes to worse and that isn't made as an available option, at least we'll be able to use our choice of firmware versions, correct?

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Well technically it's abug that its not turning off right now, I can ask him to make a'bugs on', 'bugs off' option but I think he's just gonna laugh at me.

Paradigm
Matrix Orbital
Matrix Orbital
Posts: 255
Joined: Thu Sep 13, 2001 6:00 pm
Location: Calgary, Alberta, Canada

Post by Paradigm »

One of the fixes included in the upcoming 2.0 firmware is a new power management section. By default it will power down the display after the USB bus indicates that the host is sleeping. We might include an option to ignore this, that is up in the air at the moment.
James McTavish, P.Eng
Director of Engineering
Matrix Orbital

Post Reply