Для настройки программы используется текстовый конфигурационный файл с названием название_программы.bas, представляющий собой набор функций на VB и имеющий следующую структуру:

Function GetDataLinkPath ' обязательная функция

получить путь с параметрами соединения с базой данных

  GetDataLinkPath="c:\program files\station\station.udl"

End Function

Function GetTableName () '  обязательная функция

' получить название таблицы для хранения данных

            GetTableName="TableCall"

End Function

 

Function GetCommSettings() '  обязательная функция

' получить параметры последовательного порта

            GetCommSettings="9600,M,8,1"

End Function

 

Function GetCommNumber() '  обязательная функция

' получить номер последовательного порта

            GetCommNumber=2

End Function

 

Function GetCommHandshaking() '  обязательная функция

' установить тип хадшейка

            GetCommHandshaking=2

End Function

 

Function GetLogFileName() '  обязательная функция

            GetLogFileName="c:\program files\station\station.log"

End Function

 

Function OutErrorToLog() '  обязательная функция

' вывод ошибок в лог-файл

            OutErrorToLog=False

End Function

 

' далее идут функции разбора принятой строки с целью получения значения для одноименного

' поля в таблице GetTableName. В примере используются настройки для разбора строки от станции Panasonic

 

Function DateSpeak(strBuffer)   

Dim iYear

Dim iMonth

Dim iDay

Dim strTemp

On Error Resume Next

    iMonth=CInt(Trim(Mid(strBuffer,1,2)))

    iDay=CInt(Trim(Mid(strBuffer,4,2)))

    iYear=CInt(Trim(Mid(strBuffer,7,2)))

            DateSpeak=DateSerial(iYear, iMonth, iDay)

End Function

 

' описание функций получения значений полей

Function InternalNumber(strBuffer)

            InternalNumber=Trim(Mid (strBuffer,19,3))

End Function

 

Function LineNumber(strBuffer)

            LineNumber=Trim(Mid(strBuffer,24,2))

End Function

 

Function SpeakTime(strBuffer)

Dim iHour

Dim iMinute

Dim iSecond

On Error Resume Next

            iHour=CInt(Trim(Mid(strBuffer,65,2)))

            iMinute=CInt(Trim(Mid(strBuffer,68,2)))

            iSecond=CInt(Trim(Mid(strBuffer,71,2)))

            SpeakTime=iHour*3600+iMinute*60+iSecond

End Function

 

Function BeginSpeakTime(strBuffer)

            BeginSpeakTime=Trim(Mid(strBuffer,10,8))

End Function

 

Function CallNumber(strBuffer)

            CallNumber=Trim(Mid(strBuffer,27,34))

End Function