Is it possible to take a char from an array and use it when writing code for a key tap.

 kb.KeyTap(USBC_Key ... ); 


Can you explain a little bit more?

I think the question is:
How can I access the USBC_Key Enumerations from software:

GHI example of sending the letter A via HID keyboard:
USBC_Keyboard kb = USBClientController.StandardDevices.StartKeyboard();

Currently, if I need to send a bunch of unknown characters, I would have to do something like this:

If(char x == ‘A’)
if(char x == ‘B’)

and that will be a lot of ifs, if you get my meaning.

Well, what if you need to read a file and transmit the data via HID keystrokes to a host ?

The USBC_Key Enumeration for A is 4.

this table has all the values for the USBC_Key Enumerations

so, if I read a file, and I need to send the data out as keystrokes, then the original question:

Is it possible to take a char from an array and use it when writing code for a key tap.

is asking if there is some way of storing the value for each key in an array, so that there could be an efficient way of sending every letter in the alphabet using some sort of lookup/compare.

You can use something like this:

kb.KeyTap((USBC_Key)(ch - 61));

Where ch is upper case of the character you want to send keytap for.

Thanks for the insight!

I tried this approach, and I get lower case letters as output,

here is the test code:

USBC_Keyboard kb = USBClientController.StandardDevices.StartKeyboard();

if (USBClientController.GetState() ==USBClientController.State.Running)
for(int j = 65; j<68; J++)
kb.KeyTap((USBC_Key) (j-61));

Output: abc

I’ve done this test several times, power cycle in between, so the USBizi should be in a default state. I’m sending the data over a USB port to NotePad on XP

I think the state of the CapsLock has something to do with this,
how would I read the the state of the CapsLock?

Keyboards does not send upper or lower case letters.
They only send a key, which is for axample the ‘A’ key.
The OS or driver then checks the shift state as well as other states to decide which character the key ‘A’ will generate.
If shift or shift lock is active, then you get an upper case character, if not the it’s lower case.

So you need to simulate a shift key down, then key ‘A’, then shift key up to get an upper case ‘A’ character (don’t know if this possible in NETMF).

Hope this helps.

It is supported, and the following code will do just that: