Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Java wrapper around Objective-C driver

Hi developers,


I have a pickle of a situation. I've got this barcode scanner device (OPN 2001). I've also got an SDK for it whitch includes a .dylib file (I assume it's the API for the device). I do not know objective-C. I've spoken to guys who built the device and wrote the MAC API and they do not have a Java API for it, but they told me that it would be possible to build a Java wrapper around the Objective-C driver. I am not sure if this is more of a Java question or software developement on MAC, but I jus wanted to ask what sort of options I have or how I should go around this. The software I am planning to write would pull data of the device process it and erase the device memory. I've bee working with Java for couple of years, but I am not sure where to start with this on a MAC. That's all.


Any suggestions would be appreciated.


Thanks

Mac OS X (10.6)

Posted on Mar 13, 2012 3:14 PM

Reply
5 replies

Mar 14, 2012 6:28 PM in response to Flynn91

I suggest you explore the Opticon Mac SDK a bit. I downloaded it from the vendor's product wiki (here). It looks like a typical C API. Not Objective-C. A single header file (opn_interface.h). Read the notes in the header file, which state the driver "utilizes the Carbon Event Manager to signal client code..." I am not well versed in Java on OS X, if you decide to head down that road, first make sure Java surfaces these Carbon Events (perhaps in SWT?). I would get the C++ example program fully up-and-running in Xcode as is, before jumping off in another direction. That might be challenging enough since the dates show last updated 2007.

Mar 14, 2012 8:14 PM in response to Llessur999

I've tried to get the xcode project up and running but i did not succeed. I've never used it before and the amount of configuration and compiler error is way too overwhelming. I'm a bit confused with the Carbon Events. How would i find if they could be exising in SWT? I've got a Java Wrapper written for the libopn_driver.dylib its just the Handlers that stop the progress now. What if my program wont use GUIs? Would I still need the Carbon?


Thanks

Mar 17, 2012 3:41 PM in response to Flynn91

I can't answer Java questions. But I did get the sample project to build and run. I don't have an OPN 2001 device so I can't verify it works. I think it is waiting to detect the device connection. Using OS X 10.6.8 with Xcode 4.2 (4C199) I had to make these changes before it would build and run.


1. Set the architecture and base SDK. I first tried Standard (32/64-bit Intel) but this didn't work, possibly because the dylib is 32-bit. So I used 32-bit Intel. After setting the project build settings, verify that the opn_test target build settings match, otherwise update them also.

User uploaded file


2. Add a build rule to copy the dylib so it can be found when debugging (running).

User uploaded file


The 50 compiler warnings look harmless. 46 of them are complaints about a deprecated string conversion technique used to initialize an array.

Mar 28, 2012 3:49 PM in response to Llessur999

I have made some progress in to the code, however I keep getting Linker error even though I've set settings as you advised in your screen shots. This is my error:


Ld /Users/dainius/Library/Developer/Xcode/DerivedData/opn_test-hhrksrzhnnrlqhbcprm oehryekhe/Build/Products/Debug/opn_test normal i386

cd "/Users/dainius/Downloads/SDK_EGFS012x/API/OS X/opn_test"

setenv MACOSX_DEPLOYMENT_TARGET 10.7

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/ SDKs/MacOSX10.7.sdk -L/Users/dainius/Library/Developer/Xcode/DerivedData/opn_test-hhrksrzhnnrlqhbcp rmoehryekhe/Build/Products/Debug "-L/Users/dainius/Downloads/SDK_EGFS012x/API/OS X/opn_test/build/Frameworks" "-L/Users/dainius/Downloads/SDK_EGFS012x/API/OS X/opn_test/build/Frameworks" -F/Users/dainius/Library/Developer/Xcode/DerivedData/opn_test-hhrksrzhnnrlqhbcp rmoehryekhe/Build/Products/Debug -filelist /Users/dainius/Library/Developer/Xcode/DerivedData/opn_test-hhrksrzhnnrlqhbcprm oehryekhe/Build/Intermediates/opn_test.build/Debug/opn_test.build/Objects-normal /i386/opn_test.LinkFileList -mmacosx-version-min=10.7 -framework Carbon -lopn_driver -o /Users/dainius/Library/Developer/Xcode/DerivedData/opn_test-hhrksrzhnnrlqhbcprm oehryekhe/Build/Products/Debug/opn_test


Undefined symbols for architecture i386:

"readData(OPNDriver*, int*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"getASCIIMode(OPNDriver*, bool*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"getRTCMode(OPNDriver*, bool*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"getBarcode(OPNDriver*, char*, int, int*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"timeStamp2String(OPNDriver*, char*, int, signed char*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"clearDataCmd(OPNDriver*)", referenced from:

GetPrintAndClearCodes(OPNDriver*) in main.o

"setParamCmd(OPNDriver*, signed char, char*, int)", referenced from:

ParametersAndTime(OPNDriver*) in main.o

"getParamCmd(OPNDriver*, signed char, char*, int*)", referenced from:

ParametersAndTime(OPNDriver*) in main.o

"setDefaultsCmd(OPNDriver*)", referenced from:

ParametersAndTime(OPNDriver*) in main.o

"getTimeCmd(OPNDriver*, signed char*, signed char*)", referenced from:

ParametersAndTime(OPNDriver*) in main.o

"setTimeCmd(OPNDriver*, signed char*, int)", referenced from:

ParametersAndTime(OPNDriver*) in main.o

"getEventClass()", referenced from:

OPNEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in main.o

_main in main.o

"getEventKindInsert()", referenced from:

OPNEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in main.o

_main in main.o

"getEventKindRemove()", referenced from:

OPNEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in main.o

_main in main.o

"getEventKindDataAvailable()", referenced from:

OPNEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in main.o

_main in main.o

"CreateOPNInterface()", referenced from:

_main in main.o

"getLibraryVersion(OPNDriver*, char*, int)", referenced from:

_main in main.o

"enablePolling(OPNDriver*)", referenced from:

_main in main.o

"disablePolling(OPNDriver*)", referenced from:

_main in main.o

"DestroyOPNInterface(OPNDriver*)", referenced from:

_main in main.o

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)



Thanks again.

Java wrapper around Objective-C driver

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.