EMDK Power Tip: Key Mapping

Anonymous (not verified) -
4 MIN READ
38

     Ok, by a show of hands, how many of you can put the MC40 in your right hand and power it on without using your left hand? Alright, just kidding, I can't see your hands .  But really, I just can't seem to operate that power button one-handed. Yeah, I know I could just put the device in my left hand and use my thumb to power it on, but it's still a little tricky for us right-handed folks and I end up mashing the left scan button with the palm of my hand. Is it just me or is that scan trigger on the right side below the volume buttons a perfect place to put a power button? Well, it seems someone knew I would want to do that and they included a nifty Key Programmer in the Settings menu that will let me configure what that button does.

 

     Now, with just a few taps we're all set. The MC40 can be put to sleep with the right scan trigger, and I can use my index finger to scan via the left scan trigger. Well... we're all set until a left-handed co-worker needs to use my device. Now every time they try to scan with their index finger, the device goes to sleep. Guess I will go back into settings and swap the keys around. Sure would be nice if i had a little app to swap the keys where i want them and then back if I need to hand it off? As luck would have it the EMDK has just what I need to build a little app to swap those keys around without having to dig into the settings menu. Let's spin one up.

 

     For this task, we can use the EMDK for Android or the EMDK for Xamarin, because both support the Profile Manager Key Mapping feature. At the time of this writing, only the MC18, MC40, and MC9200 running KitKat are supported, but keep an eye on the matrix of supported devices for updates.

 

     Now just load up this blog's example project and follow along. The EMDK tutorials cover the basics of how to add the EMDK to your project, use Profile Manager, and add code necessary to submit a profile. I won't cover that in this blog, but if you have any questions feel free to comment below.

 

 

After getting my project setup, I opened up Profile Manager and created a few profiles. I named one of the profiles "righthandkeymap" and the other "lefthandkeymap".

 

Screen Shot 2016-02-24 at 5.30.56 PM.png

 

In the "righthandkeymap" profile, I added two Key Mapping Manager features to the Selected Features list by selecting Key Mapping Manger on the far right, then clicked the Right arrow ( greater than symbol ).

 

In the first Key Mapping Manager feature in the selected features list I changed:

  • the Action parameter to Remap a key
  • the Choose a key to modify parameter to Button L1
  • the Key behavior parameter to Send key-code
  • the Key-code parameter to Button L1.

Keep in mind that this app was built specifically for the MC40, and that you may need to send a different KeyCode to make a button initiate a Scan. In this case, Button L1 did the trick.

 

Screen Shot 2016-02-24 at 5.31.33 PM.png

 

 

In the second Key Mapping Manager feature in the selected features list I changed:

  • the Action parameter to Remap a key
  • the Choose a key to modify parameter to Button R1
  • the Key behavior parameter to Send key-code
  • the Key-code parameter to Power.

Screen Shot 2016-02-24 at 5.31.55 PM.png

In the "lefthandkeymap" profile, I also added two Key Mapping Manager features to the Selected Features list

 

In the first Key Mapping Manager feature in the selected features list I changed:

  • the Action parameter to Remap a key
  • the Choose a key to modify parameter to Button L1
  • the Key behavior parameter to Send key-code
  • the Key-code parameter to Power.

Screen Shot 2016-02-24 at 5.32.38 PM.png

 

In the second Key Mapping Manager feature in the selected features list I changed:

  • the Action parameter to Remap a key
  • the Choose a key to modify parameter to Button R1
  • the Key behavior parameter to Send key-code
  • the Key-code parameter to Button R1.

Screen Shot 2016-02-24 at 5.32.56 PM.png

 

     After getting my profiles setup, I then added a global ProfileName variable. This is similar to how the other Profile Manager Tutorials are set up, but in this case I set it to an empty string. I then added a few buttons to the activity_main layout, labeled one of them Left, and the other one Right. Then, I set the button's OnClickListeners to update the ProfileName global with the desired profile name (lefthandkeymap for the Left button and righthandkeymap for the Right button) and then submit the profile for processing. The result was a simple User Interface to quickly swap back and forth between desired key mappings.

 

device-2016-02-24-172949.png

profile

Anonymous (not verified)

Please Register or Login to post a reply

Replies