Thread: How to declare initialization code for existing API in c block...i use concept JNI...

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    11

    How to declare initialization code for existing API in c block...i use concept JNI...

    ok now, i already include the header file for existing API and it can call the function....hmm, if not burdern you, can you guys give me a sample code for initialization code.....below is my fragment of c code....my boss want me call initialise function in existing API with not occur callback process - its called blocking mode

    Code:
    #include <jni.h>
    #include <stdio.h>
    #include "TestMMMReaderHighLevelAPI3.h"
    #include "MMMReaderHighLevelAPI.h"
    
    JNIEXPORT jlong JNICALL
    Java_TestMMMReaderHighLevelAPI3_MMMReader_1Initialise_1L3(JNIEnv * env,
                                                              jobject obj)
    {
      {
        MMMReaderHighLevelAPI scanner = new MMMReaderHighLevelAPI();
        try {
          scanner.MMMReader_Initialise(null, null, null, null, false, false,
                                       false);
    
    //INESERT TEST CODE
          printf("success");
          scanner.Close();
        }
        catch(Exception e) {
    //put code here to catch any test code errors
          printf("try again");
        }
      }
      catch(Exception e) {
    //Put code here to catch errors instantiating a Scanner driver
      }
    
    };

    and argument for method MMMReader_Initialise is like below:

    Code:
    MMM_READER_HIGH_LEVEL_API MMMReaderErrorCode
    MMMReader_Initialise(MMMReaderHLDataCallback aDataCallback,
                         MMMReaderEventCallback aEventCallback,
                         MMMReaderErrorCallback aErrorCallback,
                         MMMReaderCertificateCallback aCertCallback,
                         bool aProcessMessages, bool aProcessInputMessages,
                         void *aParam);


    can u guys help me to build a initialize code for me...bcoz it is my first time involve in integration environment...i hope u guys can help me...
    Last edited by Salem; 07-16-2012 at 11:46 PM. Reason: demungled crappy formatting - use [code][/code] tags!

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    can you be a little more specific? do you mean you want to write the code for MMMReader_Initialize so it doesn't invoke the callbacks? or do you mean MMMReader_Initialize is an API you cannot change and you want to call it without callbacks? or something else?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code::Block Land
    By imtithal in forum C++ Programming
    Replies: 2
    Last Post: 04-07-2011, 12:23 PM
  2. Can't understand this block of code
    By serg_yegi in forum C Programming
    Replies: 1
    Last Post: 03-23-2010, 06:58 PM
  3. Using iproute2 existing code for my application
    By kky in forum C Programming
    Replies: 1
    Last Post: 10-10-2007, 01:27 PM
  4. Sorting Linked Lists (code not concept)
    By Newbie Magic in forum C++ Programming
    Replies: 2
    Last Post: 05-11-2004, 08:57 AM
  5. how do you declare code?
    By stormbreaker in forum C++ Programming
    Replies: 5
    Last Post: 06-03-2003, 01:57 PM