summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2004-02-25 12:00:00 +0100
committerMartin Burnicki <martin.burnicki@meinberg.de>2004-02-25 12:00:00 +0100
commit6380def2dbce2d35e2668f6b341c7a41fcbf4f9f (patch)
treef3a55ca691de19829646632ca839169bf2c32c1b
parentbea274e5bd37e568bbe524938aafeebde5123f6d (diff)
downloadmbgsdk-win-6380def2dbce2d35e2668f6b341c7a41fcbf4f9f.tar.gz
mbgsdk-win-6380def2dbce2d35e2668f6b341c7a41fcbf4f9f.zip
Use more common file names and new module mbgdevio.basmbgdemo-vb6-1.2
-rw-r--r--common/mbgdevio.bas88
-rw-r--r--demo.bas1
-rw-r--r--demo.vbw1
-rw-r--r--mbgdemo.exe (renamed from demo.exe)bin20480 -> 20480 bytes
-rw-r--r--mbgdemo.frm (renamed from Demo.frm)76
-rw-r--r--mbgdemo.vbp (renamed from demo.vbp)9
-rw-r--r--mbgdemo.vbw2
7 files changed, 120 insertions, 57 deletions
diff --git a/common/mbgdevio.bas b/common/mbgdevio.bas
new file mode 100644
index 0000000..f5f07b3
--- /dev/null
+++ b/common/mbgdevio.bas
@@ -0,0 +1,88 @@
+Attribute VB_Name = "mbgdevio"
+
+'**************************************************************************
+'
+' $Id: mbgdevio.bas 1.2 2004/02/25 11:14:47Z martin TEST $
+'
+' Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
+'
+' Description:
+' Types and function declarations used to access Meinberg radio clock
+' devices using the mbgdevio DLL from Visual Basic.
+'
+' If there are any questions or enhancemetnt requests, please contact
+' Meinberg: support@meinberg.de
+'
+' -----------------------------------------------------------------------
+' $Log: mbgdevio.bas $
+' Revision 1.2 2004/02/25 11:14:47Z martin
+' Added definitions of the PCPS_TIME status bits.
+' Revision 1.1 2004/02/23 11:19:45Z martin
+' Initial revision
+'
+'**************************************************************************
+
+
+'
+' Some declarations used by the Meinberg mbgdevio DLL API
+' -------------------------------------------------------
+'
+
+' The structure below is passed to the function mbg_get_time
+' to read date, time, and status
+
+Public Type PCPS_TIME
+ sec100 As Byte ' 0..99
+ sec As Byte ' 0..59, 60 if leap second
+ min As Byte ' 0..59
+ hour As Byte ' 0..23
+ mday As Byte ' 1..31
+ wday As Byte ' 1..7, 1 = Monday
+ month As Byte ' 1..12
+ year As Byte ' 0..99 (year modulo 100)
+ status As Byte ' flag bits, see below
+ signal As Byte ' 0..255
+ offs_utc As Byte ' [h] signed!! (UTC = t - offs_utc)
+End Type
+
+
+' Flag bits used with the pcps_time.status field:
+
+Public Const PCPS_FREER = &H1 ' DCF77 clock running on xtal
+ ' GPS receiver has not verified its position
+
+Public Const PCPS_DL_ENB = &H2 ' daylight saving enabled
+
+Public Const PCPS_SYNCD = &H4 ' clock has sync'ed at least once after pwr up
+
+Public Const PCPS_DL_ANN = &H8 ' a change in daylight saving is announced
+
+Public Const PCPS_UTC = &H10 ' a special UTC firmware is installed
+
+Public Const PCPS_LS_ANN = &H20 ' leap second is announced
+
+Public Const PCPS_IFTM = &H40 ' the current time was set via PC interface
+
+Public Const PCPS_INVT = &H80 ' invalid time because battery was disconnected
+
+
+'
+' Some of the functions exported by the mbgdevio DLL
+' --------------------------------------------------
+'
+
+' Return the number of radio clock devices detected
+' If this function returns 0, then no devices has been detected.
+Public Declare Function mbg_find_devices Lib "mbgdevio" () As Long
+
+' Open the device with given index and retrieve a handle to the device
+' E.g. if n devices have been found, valid indices are 0..n-1
+Public Declare Function mbg_open_device Lib "mbgdevio" (ByVal i As Long) As Long
+
+' Close the device and release the device handle.
+' The device handle value will be set to 0.
+Public Declare Function mbg_close_device Lib "mbgdevio" (ByRef h As Long) As Long
+
+' Read date, time, and status from the device referenced by handle h.
+Public Declare Function mbg_get_time Lib "mbgdevio" (ByVal h As Long, ByRef t As PCPS_TIME) As Long
+
diff --git a/demo.bas b/demo.bas
deleted file mode 100644
index 1cd2b2c..0000000
--- a/demo.bas
+++ /dev/null
@@ -1 +0,0 @@
-Attribute VB_Name = "Module1"
diff --git a/demo.vbw b/demo.vbw
deleted file mode 100644
index d82ae3a..0000000
--- a/demo.vbw
+++ /dev/null
@@ -1 +0,0 @@
-Demo = 138, 128, 769, 642, Z, 22, 22, 653, 536, C
diff --git a/demo.exe b/mbgdemo.exe
index 9c8b687..130761e 100644
--- a/demo.exe
+++ b/mbgdemo.exe
Binary files differ
diff --git a/Demo.frm b/mbgdemo.frm
index 15c2b52..adeca2f 100644
--- a/Demo.frm
+++ b/mbgdemo.frm
@@ -1,5 +1,5 @@
VERSION 5.00
-Begin VB.Form Demo
+Begin VB.Form mbgdemo
Caption = "Check Radio Clock Sync Status"
ClientHeight = 1680
ClientLeft = 60
@@ -26,76 +26,48 @@ Begin VB.Form Demo
Width = 4215
End
End
-Attribute VB_Name = "Demo"
+Attribute VB_Name = "mbgdemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
+
+'**************************************************************************
'
-' This is a very simple demo program for Microsoft Visual Basic 6 which shows
-' how to access Meinberg radio clock devices via the API calls exported by
-' Meinberg's mbgdevio DLL.
+' $Id: mbgdemo.frm 1.2 2004/02/25 11:15:37Z martin TEST $
'
-' If there are any questions or enhancemetnt requests, please contact Meinberg:
-' Email: martin.burnicki@meinberg.de
-' Phone: +49 (0) 5281 9309 0
+' Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
'
-
-
+' Description:
+' Sample Visual Basic code demonstrating howto access
+' Meinberg radio clock devices using the mbgdevio.bas module
+' which contains the interface to the mbgdevio DLL shipped with
+' the driver software package.
'
-' Some declarations used by the Meinberg mbgdevio DLL API
-' -------------------------------------------------------
+' The module mbgdevio.bas must be added to the project.
+' By default, the module is located in the subdirectory "common\".
'
-
-' The structure which is normally used to read date, time, and status
-Private Type Pcps_time
- sec100 As Byte
- sec As Byte
- min As Byte
- hour As Byte
- mday As Byte
- wday As Byte
- month As Byte
- year As Byte
- status As Byte
- signal As Byte
- offs_utc As Byte
-End Type
-
-
-
+' If there are any questions or enhancemetnt requests, please contact
+' Meinberg: support@meinberg.de
'
-' Some of the functions exported by the mbgdevio DLL
-' --------------------------------------------------
+' -----------------------------------------------------------------------
+' $Log: mbgdemo.frm $
+' Revision 1.2 2004/02/25 11:15:37Z martin
+' Added standard file header, and some comments.
'
-
-
-' Return the number of radio clock devices detected
-' If this function returns 0, then no devices has been detected.
-Private Declare Function mbg_find_devices Lib "mbgdevio" () As Long
-
-' Open the device with given index and retrieve a handle to the device
-' E.g. if n devices have been found, valid indices are 0..n-1
-Private Declare Function mbg_open_device Lib "mbgdevio" (ByVal i As Long) As Long
-
-' Close the device and release the device handle.
-' The device handle value will be set to 0.
-Private Declare Function mbg_close_device Lib "mbgdevio" (ByRef h As Long) As Long
-
-' Read date, time, and status from the device referenced by handle h.
-Private Declare Function mbg_get_time Lib "mbgdevio" (ByVal h As Long, ByRef t As Pcps_time) As Long
-
+'**************************************************************************
' The function below tries to read the status of a device.
' If returned value is negative then an error has occurred.
' If the return value is not negative then the 8 LSBs of
' the return value contain the bit coded status.
+
Private Function mbg_get_device_status() As Long
Dim h As Long
Dim rc As Long
- Dim currTime As Pcps_time
+ Dim currTime As PCPS_TIME
Dim n As Integer
n = mbg_find_devices
@@ -136,6 +108,7 @@ End Function ' mbg_get_device_status
' If the return value is negative then an error has occurred.
' If the clock is synchronized then the return value is 1,
' otherwise the function returns 0.
+
Private Function mbg_device_is_synchronized() As Long
Dim status As Long
@@ -148,7 +121,7 @@ Private Function mbg_device_is_synchronized() As Long
End If
- If status And &O1 Then ' If PCPS_FREER bit is set
+ If status And PCPS_FREER Then ' If PCPS_FREER bit is set
mbg_device_is_synchronized = 0 ' then the device is not synchronized
Else
mbg_device_is_synchronized = 1 ' otherwise it is synchronized
@@ -157,6 +130,7 @@ Private Function mbg_device_is_synchronized() As Long
End Function ' mbg_device_is_synchronized
+' The subroutine below is executed whenever the "Update" button is clicked.
Private Sub Command1_Click()
Dim isSynchronized As Long
diff --git a/demo.vbp b/mbgdemo.vbp
index f56a058..28faef6 100644
--- a/demo.vbp
+++ b/mbgdemo.vbp
@@ -1,11 +1,12 @@
Type=Exe
-Form=Demo.frm
+Form=mbgdemo.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation
-IconForm="Demo"
-Startup="Demo"
+Module=mbgdevio; common\mbgdevio.bas
+IconForm="mbgdemo"
+Startup="mbgdemo"
HelpFile=""
Title="Project1"
-ExeName32="demo.exe"
+ExeName32="mbgdemo.exe"
Command32=""
Name="Project1"
HelpContextID="0"
diff --git a/mbgdemo.vbw b/mbgdemo.vbw
new file mode 100644
index 0000000..4e342a4
--- /dev/null
+++ b/mbgdemo.vbw
@@ -0,0 +1,2 @@
+mbgdemo = 138, 128, 769, 642, , 22, 22, 653, 536, C
+mbgdevio = 44, 44, 675, 558,