Convert _di_Object to ILocalObject and object initialization

137 views Asked by At

It is the first time I try to convert some Jni bridges. However I'm getting some troubles when converting some data types.

The first one is related to this autogenerated header:

Every time I try to recompile (Without the original .pas file, once I can't compile anymore (IDE restrictions)) I get some errors in the following line:

/* TJavaImport.Create */ inline __fastcall TJToast(void * ID, void * ClsID, Androidapi::Jnibridge::TJavaVTable* VTable) : Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast> (ID, ClsID, VTable) { }

ERROR:

[bccaarm Error] Androidapi.JNI.Toast.hpp(76): no matching constructor for initialization of 'Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass, _di_JToast>' Androidapi.JNIBridge.hpp(197): candidate constructor not viable: requires 0 arguments, but 3 were provided
Androidapi.JNIBridge.hpp(174): candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided

The other is related to

I was using a library wich getBonded() had already been implemented, but once I'm unable to use .pas files anymore I have to implement it manually, so I got it:

void getBonded(TStringList* res){

    JBluetoothAdapter* x;
    JSet* externalDevices;
    JIterator* it;
    JBluetoothDevice* o;
    JBluetoothDevice* remote;
    JBluetoothSocket* xx;

    x = TJBluetoothAdapter::JavaClass->getDefaultAdapter();

    externalDevices = x->getBondedDevices();
    it = externalDevices->iterator();

    while (it->hasNext()){
        o = TJBluetoothDevice::Wrap(it->next()::ILocalObject::GetObjectID());
        res->Add(JStringToString(o->getName())+"="+JStringToString(o->getAddress()));
    }
}

But I get errors in the following line:

        o = TJBluetoothDevice::Wrap(it->next()::ILocalObject::GetObjectID());

Errors:

[bccaarm Error] Main.cpp(2423): expected ';' at end of declaration [bccaarm Error] Main.cpp(2424): call to 'Wrap' is ambiguous
Androidapi.JNIBridge.hpp(187): candidate function
Androidapi.JNIBridge.hpp(188): candidate function

So I've changed the last one to (but hasn't tested yet):

o = TJBluetoothDevice::Wrap(it->next()->IJavaInstance);

Since now, thank you a lot;

0

There are 0 answers