-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defined lib.ts (ffi library from .dll)
- Loading branch information
BuildTools
committed
Aug 30, 2021
1 parent
1034b25
commit 1a77ad2
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import ffi from "ffi-napi"; | ||
import API_TYPES, { refTypeOf } from "./types"; | ||
import { SAOBRACAJNAAPI_DLL_PATH } from "../../util/get-saobracajnaApi-path"; | ||
|
||
export const createSaobracajnaApiLib = () => | ||
ffi.Library(SAOBRACAJNAAPI_DLL_PATH, { | ||
sdStartup: ["long", ["long"]], | ||
sdCleanup: ["long", []], | ||
GetReaderName: ["long", ["long", "char*", "long*"]], | ||
SelectReader: ["long", ["char*"]], | ||
sdProcessNewCard: ["long", []], | ||
sdReadDocumentData: ["long", [refTypeOf(API_TYPES.SD_DOCUMENT_DATA)]], | ||
sdReadVehicleData: ["long", [refTypeOf(API_TYPES.SD_VEHICLE_DATA)]], | ||
sdReadPersonalData: ["long", [refTypeOf(API_TYPES.SD_PERSONAL_DATA)]], | ||
sdReadRegistration: [ | ||
"long", | ||
[refTypeOf(API_TYPES.SD_REGISTRATION_DATA), "long"], | ||
], | ||
|
||
// long sdStartup(long version); | ||
// long sdCleanup(); | ||
// long GetReaderName(long index, char* readerName, long* nameSize); | ||
// long SelectReader(char* reader); | ||
// long sdProcessNewCard(); | ||
// long sdReadDocumentData(SD_DOCUMENT_DATA* data); | ||
// long sdReadVehicleData(SD_VEHICLE_DATA* data); | ||
// long sdReadPersonalData(SD_PERSONAL_DATA* data); | ||
// long sdReadRegistration(SD_REGISTRATION_DATA* data, long index); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import path from "path"; | ||
|
||
export const SAOBRACAJNAAPI_DLL_PATH = path.resolve( | ||
__dirname, | ||
"..", | ||
// "..", // because of dist folder | ||
"saobracajnaAPI", | ||
"eVehicleRegistrationAPI.dll" | ||
); |