
The information contained here are property of DIGITAX Automotive Electronics Italy, and extremely confidential. Any disclosure, copying, distribution to third
party is strictly prohibited.
49
5.
AITP (Force One keyboard)
This application shows how to use AITP to intercept the Digitax Force One key status changed events.
Sample code:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
Digitax.Sample.ForceOneKeys
{
//simple application that shows how to manage ForceOne keys
public
partial
class
ForceOneKeysForm
:
Form
{
//aitp instance
Aitp.Wrapper41.
AitpCore
_aitp =
new
Aitp.Wrapper41.
AitpCore
();
ushort
_fokstatus;
public
ForceOneKeysForm()
{
InitializeComponent();
this
.C=
new
CancelEventHandler
(ForceOneKeysForm_Closing);
//init aitp in MDT/MCU "COM4:" 19200 on ForceOne "COM3:" 38400
_aitp.AITPInit(
"COM3:"
, 38400);
_aitp.EvAITPFOKeyboardT=
new
Aitp.Wrapper41.
AitpCore
.
delAITPActivateFOKeyboardTrigger
(_aitp_EvAITPFOKeyboardTrigger);
_aitp.AITPInitKeyboard(
true
);
}
void
_aitp_EvAITPFOKeyboardTrigger(
ushort
FOKeysStatusMask,
uint
lparam)
{
_fokstatus = FOKeysStatusMask;
UpdForm();
}
private
delegate
void
delUpdForm
();
private
void
UpdForm()
{
if
(InvokeRequired)
{
this
.BeginInvoke(
new
delUpdForm
(UpdForm));
return
;
}
// FORCE ONE KEYS / LEDS Mapping
// bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
// Up Down Enter Canc K4 K3 K2 K1 OP
//update colors
if
((_fokstatus & 0x0001) == 0x0001)
{
pOP.BackColor =
Color
.Red;
}
else
{
pOP.BackColor =
Color
.Green;
}
if
((_fokstatus & 0x0002) == 0x0002)
{
pK1.BackColor =
Color
.Red;
}
else
{
pK1.BackColor =
Color
.Green;
}
if
((_fokstatus & 0x0004) == 0x0004)
{
pK2.BackColor =
Color
.Red;
}
else
{
pK2.BackColor =
Color
.Green;
}
if
((_fokstatus & 0x0008) == 0x0008)
{
pK3.BackColor =
Color
.Red;
}
else
{
pK3.BackColor =
Color
.Green;
}
if
((_fokstatus & 0x0010) == 0x0010)
{
pK4.BackColor =
Color
.Red;
}
else
Содержание Force One MDT
Страница 1: ...Force One MDT Technical Manual V 1 6...