ASecs User Manual Version 2.0.0
ASecs
User Manual
Version 2.0.0
A SECS Manual
第 2 頁
智在科技 iEW Tech
1 ASecs:........................................................................................................................... 3 1.1 Installation: ................................................................................................... 3 1.2 Difference between ASecs and WinSecs: .................................................... 6 1.3 Available data format: .................................................................................. 6
2 ASecs.ocx ..................................................................................................................... 7 2.1 Using with Visual Basic v6.0 ....................................................................... 7 2.2 Using with C#............................................................................................... 8 2.3 Object Architecture: ................................................................................... 11 2.4 Method: ...................................................................................................... 12 2.5 Property: ..................................................................................................... 14 2.6 Event........................................................................................................... 16
3 SecsTransaction:......................................................................................................... 18 3.1 Method: ...................................................................................................... 18 3.2 Property: ..................................................................................................... 19
4 SecsMessage: ............................................................................................................. 19 4.1 Method: ...................................................................................................... 19 4.2 Property: ..................................................................................................... 19
5 SecsItem: .................................................................................................................... 20 5.1 Method: ...................................................................................................... 20 5.2 Property: ..................................................................................................... 20
6 SecsLibrary: ............................................................................................................... 21 6.1 Method: ...................................................................................................... 21 6.2 Property ...................................................................................................... 21
7 Application Programming for ASecs.ocx: ................................................................. 22 7.1 Create a new application ............................................................................ 22 7.2 Modify the WinSecs Project to A+ Secs: ................................................... 22
A-1. Error Code List: .......................................................................................................... 24
A SECS Manual
第 3 頁
智在科技 iEW Tech
1 ASecs:
1.1 Installation: 1.1.1 Using Package file:
Locate the ASecs package.
Execute setup.exe of ASecs package.
Follow the setup screen to input “User name”, “Company Name” and
“Serial Number” into the “ for ASecs.
To select the destination folder :
A SECS Manual
第 4 頁
智在科技 iEW Tech
Setup type: Please select the “Typical”.
”
The setup will create the “ASECS” folder and icon, then copy the
ASecs.ocx into the destination folder (usually, it is the
C:\WINNT\System32) and register it.
1.1.2 Uninstall:
A SECS Manual
第 5 頁
智在科技 iEW Tech
Locate the ASecs package.
Execute setup.exe of ASecs package.
Select “Remove” for the uninstallation.
After click OK, the ASECS will be removed.
1.1.3 Self Register ASecs.ocx:
Open the MS-Dos command prompt.
Change the directory to ASecs on the MS-Dos command prompt.
Execute: “Regsvr32 ASecs.ocx”
A SECS Manual
第 6 頁
智在科技 iEW Tech
1.2 Difference between ASecs and WinSecs: 1.2.1 ASecs only supports HSMS protocol.
1.2.2 ASecs has Library object, this is the same concept with WinSecs’ Library
object. So you can use ReadSML method to read the sml file into ASecs
library and directly use the NewTransaction to create a SecsTransaction
object from library.
1.2.3 ASecs.ocx supports the HSMSTrace and Secs I log. HSMSTrace logs the
information of ASecs itself and it is used to identify the bug or behavior of
ASecs. So, in the application, it can be set to “Disable” when the ASecs is
stable. The SECS I logs the HSMS message and data between communication
entity. It is useful to identify the communication issue between ASecs and
other entity.
1.2.4 ASecs.ocx supports the ReadSML method to read the sml file. However, it
uses the transaction name to pair transaction in the library. If the transaction
does not have the name, the ASecs will still pair the transaction. However, the
secondary message will use the corresponding 1 Pst
P transaction in the sml files.
1.2.5 DisConnect() event argument is different from WinSecs. The ASecs.ocx
has an argument in the DisConnect event. You can use it to identify if this
disconnection by local or remote entity.
1.2.6 ConnectionMode property is string type. So, please set the property with
“ACTIVE” or “PASSIVE”.
1.2.7 SecsItem: In the WinSecs, it supports the “Delete” method. But in the
ASecs, it supports the “Remove” method.
1.2.8 Other friendly method of ASECS control, ex: CopySecsTransaction.
1.3 Available data format: SECS II Data Type A Secs enum
List hsFormatList
ASC II hsFormatAscii
Binary hsFormatBinary
I1 hsFormatI1
I2 hsFormatI2
I4 hsFormatI4
I8 hsFormatI8
U1 hsFormatU1
A SECS Manual
第 7 頁
智在科技 iEW Tech
U2 hsFormatU2
U4 hsFormatU4
U8 hsFormatU8
Boolean hsFormatBoolean
2 ASecs.ocx
2.1 Using with Visual Basic v6.0 2.1.1 Add the ASecs component into Project.
Using “Project/Components” on the menu bar of Visual Basic.
2.1.2 Drag ASecs component into form.
A SECS Manual
第 8 頁
智在科技 iEW Tech
2.2 Using with C# 2.2.1 Add Reference
A SECS Manual
第 9 頁
智在科技 iEW Tech
2.2.2 On ToolBox click “Roght Button”, then “Choose Items”
2.2.3 At “COM Components”
A SECS Manual
第 10 頁
智在科技 iEW Tech
2.2.4 To drag ASecs into your Form
A SECS Manual
第 11 頁
智在科技 iEW Tech
2.3 Object Architecture:
The ASecs contains a ActiveX component and SecsTransaction, SecsMessage,
SecsItem and SecsLibrary class.
The relation between them is:
ASecs.ocx
SecsTransaction class
SecsMessage class
SecsItem class
SecsLibrary class
A SECS Manual
第 12 頁
智在科技 iEW Tech
2.4 Method: 2.4.1 Initialization (Optional ByVal sPath As String): To initialize the ASecs.ocx.
The log will save into the “Log” folder of specified path , ex: “sPath \log”.
So, please set the value of lot attribute before calling Initialization() method.
2.4.2 ReadSML (ByVal sFileName As String): To read the specified SML file
into ASecs.ocx and build the SML’s transaction as a library. It can be used by
NewTransaction method.
The priority reads the sml to application is:
User specified full path of sml file.
User application directory sml file.
ASecs.ocx instllation directory sml file.
The auto pair rules for transaction that defined in the sml files:
Use the transaction name to pair.
Ex:
/* Formatted Status Request */
S1F5_0: 'S1F5' W
.
/* Formatted Status Data */
S1F5_0: 'S1F6'
A SECS Manual
第 13 頁
智在科技 iEW Tech
>
>
> .
/* Formatted Status Request */
S1F5_1: 'S1F5' W
.
/* Formatted Status Data */
S1F5_1: 'S1F6'
.
So, in the library, the ASecs will pair “S1F5_0” and “S1F5_1” to identify
these 2 transactions. When Use the NewTransaction() method, it can use
the “S1F5_0” to create new transaction and it will automatically create
primary and secondary message as the sml file.
If no transaction name, use the stream function name to pair.
Ex:
/* Are You There */
S1F1 W .
/* On Line Data */
S1F2
A SECS Manual
第 14 頁
智在科技 iEW Tech
.
So, in the library, the ASecs will automatically pair the 1Pst
P defined S1F2 to
S1F1 and use the “S1F1” as the transaction name.
2.4.3 ClosePort: Close HSMS communication.
2.4.4 OpenPort: Open HSMS communication
2.4.5 NewTransaction: To create a new SecsTransaction object. If the caller
passes sIndex argument, ASecs will create a new CsecsTransaction from
library. If the caller doesn’t pass the sIndex argument, the ASecs will create a
new essential SecsTransaction object.
Syntax: NewTransaction (Optional sIndex As Variant)
2.4.6 CopySecsItem: Copy a SecsItem and its sibling item from source object
into target object.
Syntax: CopySecsItem(oDest As SecsItem, oSource As SecsItem)
2.4.7 CopySecsMessage: Copy a SecsMessage and its sibling item from source
object into target object.
Syntax: CopySecsMessage(oDest As SecsMessage, oSource As SecsMessage)
2.4.8 CopySecsTransaction: Copy a SecsTransaction and its sibling item from
source object into target object.
Syntax: CopySecsTransaction(oDest As SecsTransaction, oSource As
SecsTransaction)
2.5 Property: 2.5.1 DeviceID: When creating a new transaction, the DeviceID property of
SecsTransaction is initialized to the DeviceID of the SECS control. The legal
range for the DeviceID property is 0 to 32767.
2.5.2 HSMST3: Reply TimeOut in the HSMS protocol.
2.5.3 HSMST5: Connect Separate TimeOut in the HSMS protocol. The legal range
for HSMST5 is 1 to 240 seconds. Default value is 10 seconds.
2.5.4 HSMST6: Control TimeOut in the HSMS protocol. The legal range for
HSMST6 is 1 to 240 seconds. Default value is 5 seconds.
2.5.5 HSMST7: Connection idle TimeOut in the HSMS protocol. The legal range
for HSMST7 is 1 to 240 seconds. Default value is 10 seconds.
A SECS Manual
第 15 頁
智在科技 iEW Tech
2.5.6 HSMST8: Network Intercharacter TimeOut in the HSMS protocol. The legal
range for HSMST8 is 1 to 120 seconds. Default value is 5 seconds.
2.5.7 HSMSState: Integer. HSMS connection status.
0: HSMS Initialization
1: HSMS is not connected to another entity.
2: Connect pending (T5timeout)
3: HSMS listen to another entity. (Passive mode)
4: HSMS is connecting to another entity. (Active mode)
5: HSMS is closing.
6: 2 cases:
A. Socket connected, but not selected.
B. Not selected.
7: HSMS Selecting
8: HSMS deselecting
9: HSMS selecting, but receive the another entity also sends the “Select.req”.
10: HSMS deselecting, but receive the another entity also sends the
“Deselect.req”.
11: HSMS selected.
2.5.8 ConnectionMode: “ACTIVE” or “PASSIVE”. Please see the SEMI Standard
for ACTIVE and PASSIVE usage.
2.5.9 Connected (Boolean): True when the HSMS communication connects to
remote entity. False when the HSMS communication can not connect to
remote entity.
2.5.10 Index: AHSMS control index.
2.5.11 IpAddressLocal: Local entity IP setting.
2.5.12 IpPortLocal: Local entity TCP/IP port setting.
2.5.13 IpAddressRemote: Remote entity IP setting.
2.5.14 IpPortRemote: Remote entity TCP/IP port setting.
2.5.15 IsOpen (Boolean): It will be true after the OpenPort() method is called. It
will be false after the ClosePort() method is called.
2.5.16 LibraryTransactionCount: The transaction count in the library. The library
is built by ReadSML method. It only supports the SML format in the ASecs.
A SECS Manual
第 16 頁
智在科技 iEW Tech
2.5.17 LinkTestTimer (Integer): Specify the timer to issue the link test control
transaction.
2.5.18 LogDateFormat: To specify the log of SECS I and HSMSTrace file format
of postfix.
2.5.19 LogMaxSize (Long): Specify the file size of SECS I and HSMSTrace log
file.
2.5.20 SECSILogEnable (Boolean): The ASecs will write the SECS I log and raise
Monitor event() when it is true. The default value is True.
2.5.21 SECSIILogEnable (Boolean): The ASecs will write the SECS II log. The
default value is True.
You can also write your own SECS II log format by
PrimaryIn/PrimaryOut/SecondaryIn/SecondaryOut event.
2.5.22 TraceLogEnable: The ASecs will write the HSMSTrace log when it is true.
The default value is True.
2.5.23 InterleaveMessage (Boolean): When it is true, the ASecs allow interleave
message and will send the SECS II message directly to the other entity. When
it is false, the ASecs will not send the interleave message to the other entity.
So, the next message will be sent when it receives the replied message or T3
time out.
The default value is “TRUE”.
2.6 Event 2.6.1 Connect: Trigger when ASecs HSMS communication connects to remote
entity.
Syntax: Connect()
2.6.2 Disconnect: Trigger when ASecs HSMS communication disconnects to
remote entity. The value of Entity means:
0: Local entity
1: Remote entity
Syntax: Disconnect(ByVal Entity As Integer)
A SECS Manual
第 17 頁
智在科技 iEW Tech
2.6.3 PrimaryIn: When the entity receives a message and its function is odd, the
ASecs will trigger this event to indicate the application there is a SECS II
message received.
Syntax: PrimaryIn(ByVal Trans As SecsTransaction, ByVal ErrorCode As
Long, ByVal ErrorText As String)
2.6.4 PrimaryOut: When the entity send a primary SECS II message completely,
the ASecs will trigger this event to indicate the application a transaction is
sent completely or time out.
Syntax: PrimaryOut(ByVal Trans As SecsTransaction, ByVal ErrorCode As
Long, ByVal ErrorText As String)
2.6.5 SecondaryIn: When the corresponding secondary message received
completed or HSMST3 time out, the ASecs will trigger this event. So, the
application can use the ErrorCode to identify if the transaction message is sent
or not.
Syntax: SecondaryIn(ByVal Trans As SecsTransaction, ByVal ErrorCode As
Long, ByVal ErrorText As String)
2.6.6 SecondaryOut: When the secondary message is sent completed, the ASecs
will trigger this event.
Syntax: SecondaryOut(ByVal Trans As SecsTransaction, ByVal ErrorCode As
Long, ByVal ErrorText As String)
2.6.7 Monitor: This event is triggered only when the SECSILogEnable is True.
This event is triggered when the message is sent or receive between entity.
A SECS Manual
第 18 頁
智在科技 iEW Tech
Syntax: Monitor(ByVal Sent As Boolean, ByVal ByteType As Long, ByVal
Bytes As Variant, ByVal HexBytes As String)
Sent: True means this message it sent by local entity. False means it is received
message.
ByteType: To specify the message type. It’s value will be:
hsByteTypeLength SECS I length byte
hsByteTypeHeader SECS I message header
hsByteTypeData SECS II message data
hsByteTypeSelectRequest HSMS Select Request message
hsByteTypeSelectResponse HSMS Select Response message
hsByteTypeLinkTestRequest HSMS Link Test Request message
hsByteTypeLinkTestResponse HSMS Link Test Response message
hsByteTypeDeselectRequest HSMS Deselect Request message
hsByteTypeDeselectResponse HSMS Deselect Response message
hsByteTypeRejectRequest HSMS Reject Request message
hsByteTypeSeparateRequest HSMS Separate Request message
hsByteTypeError Data Received Error
2.6.8 SecsError: When some error happen during communication or message
parsing or parameter setting.
Syntax: SecsError(ByVal ErrorCode As Long, ByVal ErrorText As String)
3 SecsTransaction:
3.1 Method: 3.1.1 Reply: Reply the Secondary message to remote entity.
3.1.2 Send: Send the Primary message to remote entity.
A SECS Manual
第 19 頁
智在科技 iEW Tech
3.2 Property: 3.2.1 ActionOnError: Variant. This property can be arbitrary used by user
application.
3.2.2 ActionOnSuccess: Variant. This property can be arbitrary used by user
application.
3.2.3 Name: String. When the ReadSML method reads the SECS transaction
from the sml file, the stream, function of transaction will be combined to
compose the identification string in the library.
3.2.4 ReplyExpected: Boolean. To identify the SECS transaction needs the
replied message or not.
3.2.5 Tag: Variant. This property can be arbitrary used by user application.
Usually, it is useful to identify the caller object.
3.2.6 SystemByte: Long.
3.2.7 Primary: SecsMessage.
3.2.8 Secondary: SecsMessage.
3.2.9 Header: String. This property return the message header of SECS I message.
3.2.10 AutoSystemByte: Boolean. Default value is True. When it is true, the
ASecs will automatically create the system byte and assign to SECS message.
When it is false, the application can assign specified system byte to the SECS
message.
4 SecsMessage:
4.1 Method: 4.1.1 Build: To parse and build receiving data from remote entity
4.2 Property: 4.2.1 Stream: String. Stream ID of message in the SECS-II.
4.2.2 Func: String.Function ID of message in the SECS-II.
4.2.3 Name: String.
4.2.4 Description: String. A description of SecsMessage.
4.2.5 ItemCount: Long. The item count of Root SecsItem.
A SECS Manual
第 20 頁
智在科技 iEW Tech
4.2.6 Root: SecsItem. The 1PstP item of message. The application should retrieve or
set the message item value through it.
5 SecsItem:
5.1 Method: 5.1.1 AddNew: Add a new child SecsItem. The nIndex will be converted into
string and used as the identification of new child SecsItem.
Syntax: AddNew(ByVal nIndex As Long)
5.1.2 Parse: To parse the received message.
5.1.3 Remove: Remove a child SecsItem. The nIndex could be a number or string.
If passed nIndex is a string, the Remove method will use it as an identification
to remove the item. If passed nIndex is a number, the Remove method will
use it as the sequence to remove the item.
Syntax: Remove(ByRef nIndex As Variant)
5.2 Property: 5.2.1 Description: A description of SecsItem.
5.2.2 Format: Format of SECS II data type.
5.2.3 Item: Sibling item.
5.2.4 ItemCount: The count of the child SecsItem.
5.2.5 Raw: To get the braw data (binary format) of item or to get the value of
binary format item.
5.2.6 Value: The value of SecsItem.
For Binary format, the application gets the value using the Raw property.
For List format, the application will copy the SecsItem and its sibling item
from source object into target object. Just like the CopySecsItem() method.
A SECS Manual
第 21 頁
智在科技 iEW Tech
6 SecsLibrary:
6.1 Method: 6.1.1 AddNew: To add a new transaction in the library for further usage.
Syntax: AddNew(ByVal id As Variant) As SecsTransaction
The id can be index number or identified string in the library.
6.1.2 Remove: To remove a transaction from the library.
Syntax: Remove(ByVal id As Variant)
The id can be index number or identified string in the library.
6.1.3 Transaction: To new a transaction from the library list.
Syntax: Transaction(ByVal id As Variant) As SecsTransaction
The id can be index number or identified string in the library.
6.2 Property 6.2.1 TransactionCount: Long. The count of transaction in the library.
6.2.2 Item: To get the transaction from the library.
Syntax: Item(ByVal index As Variant) As SecsTransaction
A SECS Manual
第 22 頁
智在科技 iEW Tech
7 Application Programming for ASecs.ocx:
7.1 Create a new application
7.2 Modify the WinSecs Project to A+ Secs: 7.2.1 Changes the WinSecs SecsTransaction’s “Function” property to A+ Secs
SecsTransaction’s “Func” property.
Ex: WinSecs: Trans.Function = 1
Changes to A+ Secs: Trans.Func = 1
7.2.2 Add the A+ Secs “Initialization” method call before calling the OpenPort()
method.
7.2.3 Modify the DisConnect() event:
Argument is different from WinSecs
WinSecs: ByVal ErrorCode As Long, ByVal ErrorText As String
Initialize
Setup A-Plus Secs parameter
Library object
ClosePort
SecsTransaction
Event Handling
OpenPort
SecsMessage SecsItem
HSMS State
A SECS Manual
第 23 頁
智在科技 iEW Tech
A+ Secs: ByVal Entity As Integer
The error about TCP/IP socket will be reported at
SecsError(ByVal ErrorCode As Long, ByVal ErrorText As
String) event.
7.2.4 Modify the ConnectionMode property.
WinSecs: ConnectionMode (Long)
wsConnectionModePassive (0)
wsConnectionModeActive (1)
wsConnectionModeAlternating (2)
A+ Secs: ConnectionMode (String)
“Passive”
“Active”
7.2.5 The root SecsItem is necessary in the A+ Secs. But in the WinSECS it can
be omitted. So, add the Root SecsItem if WinSecs application uses the
abbreviation.
Ex: To access the 1st item of PrimaryMessage:
WinSecs: Both PrimaryMessage.Item(1) and
PrimaryMessage.Root.Item(1) are OK.
A+ Secs: PrimaryMessage.Root.Item(1) is acceptable.
7.2.6 Modify the SecsItem delete method.
WinSecs: Use the Delete method.
Ex: To remove item(2) of TempItem. TempItem(1).Item(2).Delete
A+ Secs: Use the Remove method.
Ex: To remove item(2) of TempItem. TempItem(1).Remove 2
A SECS Manual
第 24 頁
智在科技 iEW Tech
7.2.7 Appendix:
A-1. Error Code List: Error Code Description
1001 Connection Mode setting parameter error. (Active/Passive setting error)
1002 IpAddressLocal setting parameter error.
1003 IpaddressRemote setting parameter error.
1004 IpPortLocal setting parameter error.
1005 IpPortRemote setting parameter error.
1006 HSMS T3 setting parameter error.
1007 HSMS T5 setting parameter error.
1008 HSMS T6 setting parameter error.
1009 HSMS T7 setting parameter error.
1010 HSMS T8 setting parameter error.
1011 LinkTest Timer setting parameter error.
1012 Device ID parameter setting error. The value is 0 - 32767
1020 Get Raw the input index error.
2000 HSMS T3 Time Out.
2001 HSMS T5 Time Out.
2002 HSMS T6 Time Out.
2003 HSMS T7 Time Out.
2004 HSMS T8 Time Out.
2005 Receive unexpected Secondary Message. Please check if T3 time out.
7 記憶體不足
380 屬性值無效
383 屬性是唯讀的
394 屬性不可讀
40006 所請求的交易或請求本身的錯誤通訊協定或者錯誤連線狀態
40014 傳遞給函數的引數格式不正確,或是不在指定範圍內
40018 無法支援的變數型態
40020 在目前狀態下的無效作業
40021 引數超出範圍
40026 所請求的交易或請求本身的錯誤通訊協定
1004 取消作業
10014 所請求的位址是廣播位址,但未設定記號
10035 Socket 不是區塊,但指定作業將使之成區塊
10036 有區塊的 Winsock 作業正在進行中
A SECS Manual
第 25 頁
智在科技 iEW Tech
10037 完成作業。沒有區塊作業在處理中
10038 描述字元不是 Socket
10040 資料串太大,無法放入緩衝區,多餘資料將被截掉
10043 不支援指定的連接埠
10048 位址在使用中
10049 來自本地電腦的位址無法使用
10050 網路子系統失敗
10051 此時無法從主機到達網路
10052 在設定 SO_KEEPALIVE 時,連線逾時
10053 由於逾時或者其它失敗而取消連線
10054 透過遠端重新設定連線
10055 沒有可用的緩衝空間
10056 已連線 Socket
10057 未連線 Socket
10058 已關閉 Socket
10060 已關閉 Socket
10061 強行拒絕連線
10093 應該先呼叫 WinsockInit
11001 授權回應:未找到主機
11002 非授權回應:未找到主機
11003 無法復原的錯誤
11004 有效名稱,沒有合乎所請求型態的資料錄