Prepare JSON passing & get all device ids

Here only JSONException is possible, for now we do not throw any exceptions from C++ to Java (and I'm not 100% sure that we should).