SDK Instruction
SDK Instruction
Between software and hardware communication: establish communication channels for software and hardware
communication.
Promotion between software and hardware communication efciency: input transfer value and receive value
to complete between software and hardware communication.
Promotion the efciency of application software development: Help software engineers to develop application
software can quickly and easily communicate with the hardware.
Seamless Integration of software and hardware: Full support for protocol all features and full highlight SOYAL
product characteristics.
E Series
AR-401E
AR-716E
AR-829E
1. Protocol
H Series
AR-721H
AR-727H
AR-321H
AR-327H
AR-757H
AR-725E
AR-401DI16
AR-401RO16
U Series
AR-737P
Serial Port
SoyalComm.dll
Ethernet
VSCOM
2. Resource
3. Demo Code
VC2005 Demo Code
Protocol
Protocol provide SOYAL all products Protocol and command code, application software developer utilize
Protocol and command code to seamless Integration of software and hardware. The same package command
code divided into three categories: E series command code, H series command code and U series command
code. E series command code SOYAL products: AR-721E, AR-401E, AR-716E and AR-829E, H series command code SOYAL products: AR-721H, AR-727H, AR-321H, AR-327H, AR-757H, AR401DI16, AR401RO16
and AR-725E, U series command code SOYAL products: AR-737P.
6-1
Chapter 6 SDK
Resource
Declaration of function name, variables, variable type and return value of function from the SoyalComm.dll.
6-2
TECHNOLOGY CO.,LTD.
void*
CreateSPort( void )
If DeleteSPort() return value not 0 mean COM port deleted successful else deleted fail.
Effect: Delete the object created by CreateSPort()
DeleteSPort() can delete communication object established by CreateSPort().
6-3
Chapter 6 SDK
6-4
TECHNOLOGY CO.,LTD.
BOOL ReadWriteSComm( void *pComm, BYTE* TxBfx, BYTE* RxBfx, WORD* pLen )
ReadWriteSComm() return value type is Boolean, delivering following variable to Call ReadWriteSComm():
Variable type is pointer and variable name is pComm
Variable type is BYTE and variable name is TxBfx
Variable type is BYTE and variable name is RxBfx
Variable type is WORD and variable name is pComm
In :
DWORD
GetSCommStatus() return value type is WORD, delivering pointer variable pComm to Call GetSCommStatus().
In :
Communication Object address, that create by CreateSPort
Address be delivered to *pComm is communication object established by CreateSPort().
Returns: Return unsigned long data of last ReadWriteSComm status
GetSCommStatus() return value is latest GetSCommStatus() status.
6-5
Chapter 6 SDK
6-6
TECHNOLOGY CO.,LTD.
6-7
Chapter 6 SDK
VSCOM
SOYAL SDK provide VSCOM to assist you create virtual serial ports in your system, and
redirects all serial data to specied TCP-port of remote IP-address. Any serial communication
software can use these virtual COM ports, like typical hardware COM ports, to send and receive serial data over a local network or the Internet.
VSCOM advantages is to assist application software engineers develope application software in TCP/IP and don't modify original serial application or additional hardware devices
case, serial data will be sent directly to the network.
6-8
TECHNOLOGY CO.,LTD.
Demo Code
SOYAL SDK provide 2 different language structure example code: VB2005 Demo Code and VC2005 Demo
Code to assist software developer understand how to use SOYAL SDK and develop application software.
Start
Import
SoyalComm.vb
Check
COM Port
is available
Record the
communication object
can not be opened
Y
Record the
communication object
can be opened
pComm = CreateSPort()
Create failure
message
is successfully created
Y
Open
COM Port
Open successful
message
Run
Sign in Level 2
Retry
Sign in Level 2
TxBfx(0) = &H1
TxBfx(1) = &H20
TxBfx(2) = &H11
TxBfx(3) = &H22
TxBfx(4) = &H33
TxBfx(5) = &H44
nLen = 6
Receive / Deliver
command code
Fail
Receive / Deliver
failure message
Succeed
Received
message
Run
Sign out Level 2
Retry
Receive / Deliver
command code
Fail
dwError = GetSCommStatus(pComm)
If dwError And Comm_RxTimeOut Then
LabMsg.Text = "Timeout!"
End If
If dwError And Comm_RxErrSum Then
LabMsg.Text = "Check Sum Error"
End If
If dwError And comm_TxErrLength Then
LabMsg.Text = "Cann't send to serial Port!"
End If
Receive / Deliver
failure message
Succeed
Received
message
Close
COM Port
CloseSComm(pComm)
Delete
communication Object
DeleteSPort(pComm)
Delete successful
message
End
6-9
Chapter 6 SDK
Import SoyalComm.h
Import
SoyalComm.h
#include
"SoyalComm.h"
if( IsPortAvailable( i ) ) {
// Do something like add to selection box
}
Record the
Record the
communication object communication object
can not be opened
can be opened
COM Port
is checked
Y
Whether the
communication object
Create failure
message
is successfully created
pComm = CreateSPort()
Open
COM Port
Open successful
message
Run
Sign in Level 2
Retry
Receive / Deliver
command code
Fail
Receive / Deliver
failure message
Succeed
Received
message
Run
Sign out Level 2
Retry
Receive / Deliver
command code
Fail
Receive / Deliver
failure message
Succeed
Received
message
Close
COM Port
CloseSComm( pComm );
Delete
communication Object
DeleteSPort( pComm );
End
6-10
TECHNOLOGY CO.,LTD.
01
Installation VSCOM
Click
Step.
02
Start VSCOM
6-11
All Programs
Soyal Software
Chapter 6 SDK
Step.
03
Execution VSCOM
Step 1.
Step 3.
6-12