Software Development

 ActiveX API documentation

 ActiveX Control for iPerlG2 Visual/Data Integration Terminal

General

As the Visual Data Terminal, the iPerlG2 terminal can support internal devices and many external devices work concurrently. For internal integrated devices, the iPerlG2 M144 is equipped with 6 channels DI input, 4 channel video input, 2 RS232 port, 1 RS485 port. For external devices, system integrator can attach device to these 2 RS232/1RS485 port to control or retrieve data from external RS232/RS485 device. In order to tell these different devices, iPerlG2 M144 assigns individual device that it can support with different number and we call it SID. The SID is a 16bit unsigned integer (0xABCD). The first three hex characters (0xABC_) represent the device class ID, the last hex character (0x___D) represent channel ID.

For integrated device, the Device Class is:

STREAM_CLASS_CONTROL

0x0000

Internal Control Class

STREAM_CLASS_MPEG1_CTRL

0x0010

Video Control Class

STREAM_CLASS_MPEG1

0x0020

Video Data Class

STREAM_CLASS_RS232

0x0030

RS232 Class

STREAM_CLASS_RS485

0x0040

RS485 Class

STREAM_CLASS_GPIO

0x0050

DI/DO Class

STREAM_CLASS_EVENT

0x0060

Event Class

STREAM_CLASS_PTZ

0x0070

PTZ Class

STREAM_CLASS_DEFAULT

0x0080

Default Class
STREAM_CLASS_DIO

0x0090

Digital IO Device
STREAM_CLASS_DAC

0x00A0

Digital Analog Convert Device
STREAM_CLASS_RAC

0x00B0

Remote Access Class
STREAM_CLASS_ADAM4050

0x00C0

ADVANTECH ADAM4050 Class
STREAM_CLASS_PLAYER_CTRL

0x00D0

Remote Player Control Class
STREAM_CLASS_PLAYER

0x00E0

Remote Player Stream Class
STREAM_CLASS_SEARCH

0x00F0

Remote File Search Class

More class ID can be added to support more external device. Please check the AcroComm iPerlG2 M144 product support web side for the latest list of device class can be support and the related command set of device.

Each device class can have at most 16 different channels.

Channel Name

Channel Number (0x___D)

CTRL_CHN

0 (0x00)

CHN0

0 (0x00)

CHN1

1 (0x01)

CHN2

2 (0x02)

CHN3

3 (0x03)

CHN4

4 (0x04)

CHN5

5 (0x05)

CHN6

6 (0x06)

CHN7

7 (0x07)

CHN8

8 (0x08)

CHN9

9 (0x09)

CHNA

10 (0x0A)

CHNB

11 (0x0B)

CHNC

12 (0x0C)

CHND

13 (0x0D)

CHNE

14 (0x0E)

CHNF

15 (0x0F)

The SID is the arithmetic plus of (Device Class ID + Device Channel ID)

For example,

The iPerlG2 M144 control-channel SID: (STREAM_CLASS_CONTROL+CTRL_CHN) = 0x0000

The iPerlG2 M144 video-data SID: (STREAM_CLASS_MPEG1+CHN1) = 0x002


ActiveX Property

iperlg2.HostAddress

The IP address of destination iPerlG2 M144

 

iperlg2.ProxyAddress

The Stream Proxy Server IP address

 

iperlg2.UserName

The login name to iPerlG2 M144

 

iperlg2.Password

The password for logging


ActiveX Method

DWORD iperlg2.Connect()

Connect to iPerlG2 M144 with address as specified iperlg2.HostAddress

Ex. status = iperlg2.Connect(Mode);

 

DWORD iperlg2.ConnectProxy()

Connect to Stream Proxy Server with address as specified iperlg2.ProxyAddress

Ex. status = iperlg2.ConnectProxy(Mode);

 

DWORD iperlg2.Disconnect()

Connect to iPerlG2 M144 with address as specified iperlg2.HostAddress

Ex. status = iperlg2.Disconnect()

 

DWORD iperlg2.OpenStream(SID, Parameter)

Open connection to the SID device. Parameter will be the initial setting parameter of this device. It will return a session ID for this command.

Ex. session = iperlg2.OpenStream(STREAM_ID_MPEG1_CHN1, “SKIP=2?;

 

DWORD iperlg2.SendCommand(DWORD SID, BSR Command, BSR Parameter)

Send command/parameter to the SID device. It will return a session ID for this command.

Ex. session = iperlg2.PostCommand(STREAM_ID_MPEG1_CHN1, “SKIP=3?;

 

BSTR iperlg2.TransactCommand(DWORD SID, BSR Command, Parameter, BSR Timeout, DWORD bCount, BSR bByte)

Send command/parameter to the SID device and wait for response from device. The timeout is the timeout value in ms. if this function gets no response from device after timeout, it will return. The bCount is the size of bByte and if it gets the response, it will become the byte count of response data. bByte should be a memory address to save the response data. If it gets the response before timeout, it will return immediately and saves the response at bByte.

It will return a session ID for this command

Ex. session = iperlg2.TransactCommand(STREAM_ID_MPEG1_CHN1_CTRL, “GET? "BRI=*&SAT=*&CON=*&HUE=*", 1000, 1024, Result);

The result of this command should be like, “BRI=160&SAT=120&CON=80&HUE=0"

 

iperlg2.GetValueByName(Name, Value, bCount, bResult,);

Get the value of name at name=value string of bResult. The bCount is the length of bResult;


ActiveX Event

iperlg2.OnConnect()

When user specify HostAddress and use connect method, the ActiveX will generate this event after successfully connects to iPerlG2 M144.

iperlg2.OnDisconnect()

When user specify Disconnect, after successfully disconnect from iPerlG2 M144, the ActiveX will generate this event.

iperlg2.OnError(Code)

When there is error happen between iPerlG2 M144 and ActiveX control.

iperlg2.OnRead(DWORD SID, TimeCode, Session, bCount, bByte)

When there is data received from iPerlG2 M144 the ActiveX will generate this event.


Command Format

Every command from ActiveX control to iPerlG2 M144 has a Command Name and the Parameter related to the command. The parameter is format as “Name=Value?and can be cascade with next parameter with ?amp;?symbol.

For example, to change the live video brightness, saturation of iPerlG2 M144, you can use the following command:

 

iperlg2.SendCommand(STREAM_ID_CHN1, “BRI=100&SAT=50?;

The BRI=100 means that set brightness to value 100.

The SAT=50 means that set saturation to value 50.

Because there are two parameters, so we cascade it with symbol ?amp;?/font>

Open a Data Stream

SID must be open first before the command can be sent to iPerlG2 M144. In this case, developer should use iperlg2.OpenStream(SID, Parameter) to open a stream first.

The SID means the Stream ID and Parameter will be the initial setting of this data stream. For each individual iPerlG2 M144 connection, the iPerlG2 M144 can’t accept multiple stream with same SID number.

Syntax: iperlg2.OpenStream(SID, Parameter);

 

Put it Together

Here is the simple example to illustrate how to get and change the brightness of video source.

1. iperlg2.HostAddress = ?92.168.1.252:8000?

2. iperlg2.Connect();

3. iperlg2.OpenStream(STREAM_ID_CHN1, ?);

4. bCount = 1024;

5. iperlg2.TransactCommand(STREAM_ID_CHN1, “GET? “BRI=*? 2000, bCount, bResult);

6. iperlg2.GetValueByName(“BRI? Value, bCount, bResult,);

7. dwBRI = atoi(Value);

8. dwBRI = dwBBRI + 1;

9. sprintf(Command, “BRI=%d? dwBRI);

10. iperlg2.SendCommand(STREAM_ID_CHN1, “SET? Command);

ActiveX Control Manual Un-installation

Please find the ActiveX Control binary file. Usually, it is in Windows System32 directory. (Ex. C:\Windows\System32) and there are 1 ActiveX control binary and 1 COM server binary. One is iperlg2.ocx and the other is iperlg2_axserver.exe .

The GUID:

For iperlg2.ocx is: DCBCB9DA-5034-4C3F-A023-F84A61CE065E

For iperlg2_axserver.exe is: F9B46A5D-C7F7-4334-8C58-AA985CABFD4D

To remove these two components,

For iperlg2.ocx: regsvr32 -u iperlg2.ocx

For iperlg2_axserver.exe: iperlg2_axserver.exe –unregserver