VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4590
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7875
   LinkTopic       =   "Form1"
   ScaleHeight     =   4590
   ScaleWidth      =   7875
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton TestBtn 
      Caption         =   "Test"
      Height          =   375
      Left            =   3000
      TabIndex        =   1
      Top             =   4080
      Width           =   1575
   End
   Begin VB.ListBox List1 
      Height          =   3765
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' ==========================================================================
' Get hardware info
' (1) harware info
'	a) FactoryTime, the Date that ROCKEY was made
'	b) HardSerial, gloablly unqiue hardware serial number
'	c) ShipTime, the Date the ROCKEY was sold
'	d) COSVersion, the Card operation system version
' (2) Use DIC_Get to get info, we can set the last parameter to NULL
' ==========================================================================

Private Sub TestBtn_Click()
Dim errcode, num, hic, i As Long
Dim cmddata(0 To 255) As Byte ' command buffer
Dim curline As Integer
Dim FactoryTime, HardSerial, ShipTime As Long
Dim COSVersion(0 To 3) As Byte

curline = 0

num = DIC_Find()
For i = 0 To num - 1
    hic = DIC_Open(i, 0&)
    If (hic >= 0) Then
        Exit For
    End If
Next i
If (i = num) Then
    Exit Sub
End If

errcode = DIC_Command(hic, GET_HARDWARE_INFO, cmddata(0))
FactoryTime = DIC_Get(cmddata(0), FACTORY_TIME, BY_VALUE, 0&)
HardSerial = DIC_Get(cmddata(0), HARD_SERIAL, BY_VALUE, 0&)
ShipTime = DIC_Get(cmddata(0), SHIP_TIME, BY_VALUE, 0&)
errcode = DIC_Get(cmddata(0), COS_VERSION, BY_ARRAY, COSVersion(0))
List1.List(curline) = "FactoryTime: " + Hex(FactoryTime)
curline = curline + 1
List1.List(curline) = "HardSerial: " + Hex(HardSerial)
curline = curline + 1
List1.List(curline) = "ShipTime: " + Hex(ShipTime)
curline = curline + 1
List1.List(curline) = "COSVersion: " + Chr(COSVersion(3)) + Chr(COSVersion(2)) + "." + Chr(COSVersion(1)) + Chr(COSVersion(0))

curline = curline + 1

errcode = DIC_Close(hic)
End Sub

