milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

Enable RF for DENSO BHT-200BW-CE devices using late binding

Details
Written by: Stanko Milosev
Category: Lazarus
Published: 12 November 2011
Last Updated: 18 December 2011
Hits: 5991

This is one example of late binding using Lazarus, and example of disabling radio frequency DENSO BHT-200BW-CE devices, API manual you can download from here.

...
uses dynlibs;

...

procedure TForm1.Button4Click(Sender: TObject);
type
  TBHT_RF_CloseEx = function(_opt:DWord): DWord; stdcall;
var
  BHT_RF_CloseEx : TBHT_RF_CloseEx;
  FDllHandle: TLibHandle;
  intRes: DWord;
  intError: Integer;
begin
  FDllHandle := LoadLibrary('BHTLib.dll');
  intError := GetLastError;
  if FDLLHandle = NilHandle then begin
   ShowMessage(SysErrorMessage(intError) + ' (Error ' + IntToStr(intError) + ')');
  end else begin
    BHT_RF_CloseEx := TBHT_RF_CloseEx(GetProcedureAddress(FDllHandle, 'BHT_RF_CloseEx'));
    intError := GetLastError;
    if BHT_RF_CloseEx = nil then begin
      ShowMessage(SysErrorMessage(intError) + ' (Error ' + IntToStr(intError) + ')')
    end else begin
      intRes := BHT_RF_CloseEx(1);
    end;
  end;
end;

Another example is:

procedure TForm1.Button4Click(Sender: TObject);
type
  TBHT_RF_CloseEx  = function(_opt:DWord): DWord; stdcall;
var
  BHT_RF_CloseEx : TBHT_RF_CloseEx;
  p: pointer;
  FDllHandle: TLibHandle;
  intRes: DWord;
  intError: Integer;
begin
  FDllHandle := LoadLibrary('BHTLib.dll');
  intError := GetLastError;
  if FDLLHandle = NilHandle then begin
   ShowMessage(SysErrorMessage(intError) + ' (Error ' + IntToStr(intError) + ')');
  end else begin
    p := GetProcAddress(VBHTLibHandle, 'BHT_RF_CloseEx');
    if p <> nil then begin
      Pointer(BHT_RF_CloseEx) := p;
    end;
    intError := GetLastError;
    if BHT_RF_CloseEx = nil then begin
      ShowMessage(SysErrorMessage(intError) + ' (Error ' + IntToStr(intError) + ')')
    end else begin
      intRes := BHT_RF_CloseEx();
    end;
  end;
end;

For opening and closing you can use:

BHT_RF_Open() (*1)
BHT_RF_Close() (*2)
BHT_RF_OpenEx(COMM_CONTINUOUS)
BHT_RF_CloseEx(COMM_CONTINUOUS)

(*1) Includes BHT_RF_OpenEx(COMM_NORMAL)
(*2) Includes BHT_RF_CloseEx(COMM_NORMAL)

Where COMM_CONTINUOUS is 1, and COMM_NORMAL is 0 (I hope)

Establishing GPRS Connection on Windows CE and Windows Mobile

Details
Written by: Stanko Milosev
Category: Lazarus
Published: 09 November 2011
Last Updated: 18 December 2011
Hits: 6586

Code is taken from here, and translated to Lazarus.

Dialing:

uses ras

...
var
  rasDialParam:RASDIALPARAMS;

  pRasConn:HRASCONN;

  dwResult: DWORD;

begin
  pRasConn := null;

  FillChar(rasDialParam, SizeOf(RASDIALPARAMS), 0);
  rasDialParam.dwSize:=SizeOf(RASDIALPARAMS);
  rasDialParam.szCallbackNumber[0]:=#0;
  rasDialParam.szDomain[0]:=#0;
  rasDialParam.szEntryName:='ConnName'; //important, name of the connection which I want to use
  rasDialParam.szPassword:='pass'; //important, if pass or user is wrong, then I will receive error code 619
  rasDialParam.szPhoneNumber[0]:=#0; 
  rasDialParam.szUserName:='user'; //important

  dwResult := RasDial(nil, nil, @rasDialParam, null, nil, @pRasConn);
  if dwResult = ERROR_SUCCESS then
    ShowMesage('It is working')
  else
    ShowMesage('Error: ' + IntToStr(dwResult))

Get connection status:

...
var
  dwResult: DWORD;
  MyRasconnstatus: RASCONNSTATUS;
...
 dwResult := RasGetConnectStatus(VRasConn, @MyRasconnstatus);
 if dwResult = ERROR_SUCCESS then 
 begin
   if MyRasconnstatus.rasconnstate = RASCS_Connected then 
   begin
     ShowMessage('Connected')
   end 
   else 
   begin
     ShowMessage('Not connected')
   end;
 end;

Hang up:

 RasHangUp(VRasConn)

List of error codes you can find here, or here.

Extracting GPS coordinates from a large number of photos

Details
Written by: Stanko Milosev
Category: Downloads
Published: 22 March 2025
Last Updated: 22 March 2025
Hits: 722

Fast Extraction of GPS Coordinates and Saving to CSV, JSON, or a Database

Usage:

BatchExtractGpsCoordinates.exe folder:C:\ csvFile:test.csv jsonFile:test.json connectionString:"Server=myServer;Database=myDb;User Id=myUser;Password=myPass;TrustServerCertificate=True;" tableName:GpsInfo

Notes:

  • The parameters csvFile, jsonFile, and connectionString are optional, but at least one of them must be provided.
  • If connectionString is set but tableName is not, the default table name GpsInfo will be used.
  • A log file named BatchExtractGpsCoordinates.log will be automatically created in the same folder as BatchExtractGpsCoordinates.exe

Download the EXE in ZIP format from here; the source code can be found here.

Validation of XML Files for Electronic Invoicing

Details
Written by: Stanko Milosev
Category: Downloads
Published: 09 November 2024
Last Updated: 17 November 2024
Hits: 1332
First, a bit of background.

Electronic invoicing (also called e-invoicing or einvoicing) is a form of electronic billing.

Under EU Directive 2014/55/EU on electronic invoicing in public procurement, the EU commissioned the development of a "European standard on electronic invoicing" - European Union, Directive 2014/55/EU on Electronic Invoicing in Public Procurement, 16 April 2014, Article 3

EN 16931-2 Electronic invoicing - Part 2: List of syntaxes that comply with EN 16931-1 describes the syntaxes that can be used to represent an electronic invoice: UBL 2.1 - Universal business language version 2.1 and CII 16B - Cross Industry Invoice in XML Schemas 16B XML files.

The official Schematron eInvoicing-EN16931 artefacts for CEN/TC 434 are here

The abreviation EN16931 stands for EN - abbreviated EN, from the German name Europäische Norm ("European Norm") and it was developed by European Committee for Standardization (CEN, French: Comité Européen de Normalisation)

---

The problem is that .NET natively supports neither Schematron validation nor XSLT (Extensible Stylesheet Language Transformations) 2.0

In my list of articles I gave a few examples of how Electronic Invoicing XML documents can be validated in .NET. The result is my application for document validation.

Another way to test if XML documents comply with EN16931 standard is by using KoSIT Validator. Here is an example using KoSIT Validator 1.5.0 and Validator Configuration 2024-06-20 compatible with XRechnung 3.0.x:

java" -jar "\validator-1.5.0-distribution\validationtool-1.5.0-standalone.jar" -s "\validator-configuration-xrechnung_3.0.2_2024-06-20\scenarios.xml" -r "\validator-configuration-xrechnung_3.0.2_2024-06-20" "eInvoice.xml" -h -o \output
Without TPL library download exe from here source code from here. If you need XML files good and wrong for tests, download from here.

With TPL library download from here , source from here

Source you can also find on GitHub
  1. Reminder
  2. Just another real time tracking app
  3. Android application package (APK)
  4. OCR

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 136 of 165

  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140