[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
java bindings
From: |
okki |
Subject: |
java bindings |
Date: |
Wed, 30 May 2007 08:18:20 +0200 |
hi gnokiis,
i've started a jni wrapper for gnokii yesterday (therefor the patch
today). it's not too beautiful yet, but i'm working on it.
some technical aspects
- automated jni generation with the eclipse swt generators (modified)
- thin layer, direct access to the well know fields and functions
- implemented the windows bluetooth stack to enumerate devices
- coded in msvc2003 (should compile on gcc and linux, too)
sourcecode can be found at http://www.netallied.de/temp/jgnokii_src.zip
binaries (windows) at http://www.netallied.de/temp/jgnokii.zip
the binaries consist of the libgnokii.dll and the jgnokii.dll (jni
wrapper). sources look like
gn_statemachine state = new gn_statemachine();
state.current_state = 0;
for (int i=0; i<model.length(); i++) {
state.config.model [i] = (byte) model.charAt (i);
}
for (int i=0; i<port_device.length(); i++) {
state.config.port_device [i] = (byte) port_device.charAt (i);
}
state.config.connection_type = 5;
state.config.serial_baudrate = 19200;
state.config.smsc_timeout = 10;
state.config.rfcomm_cn = 1;
int error = -1;
error = OS.gn_lib_phone_open(state);
gn_data data = new gn_data();
data.sms_status = new gn_sms_status();
error = OS.gn_sm_functions(OS.GN_OP_GetSMSStatus, data, state);
System.out.println("messagecount: " + data.sms_status.number);
data.memory_status = new gn_memory_status();
data.memory_status.memory_type = OS.GN_MT_SM;
error = OS.gn_sm_functions(OS.GN_OP_GetMemoryStatus,
data, state);
System.out.println("free: " + data.memory_status.free);
System.out.println("mem_type: " + data.memory_status.memory_type);
System.out.println("used: " + data.memory_status.used);
error = OS.gn_sm_functions(OS.GN_OP_Identify, data, state);
System.out.println("model: " + new String(data.model).trim());
System.out.println("manufacturer: " + new
String(data.manufacturer).trim());
System.out.println("revision: " + new String(data.revision).trim());
System.out.println("imei: " + new String(data.imei).trim());
error = OS.gn_lib_phone_close(state);
thats it :) i'm currently tinkering with skipping the swt generation and
create a simplified layer...
and btw: no plans to release the gnokii library under a more "liberal"
license like lgpl?
regards
-- okki