Task #2509
closedTask #1989: Basic NFD control app for Android
Implement jni equivalent of daemon/main.cpp to start NFD/NRD
100%
Description
Few things that needs to be resolved as part of this commit:
- what configuration parameters should be configurable inside NFD control app
- how these customization parameters are represented on Java side
- how they are passed to JNI function
Updated by Alex Afanasyev over 9 years ago
Ivan, do you have suggestion on second item in the list?
Updated by Alex Afanasyev over 9 years ago
- Status changed from In Progress to Code review
- % Done changed from 0 to 60
Updated by Alex Afanasyev over 9 years ago
This issue is still open, as currently initial NFD settings are hard-coded inside the jni wrapper (https://github.com/named-data/NFD-android/blob/master/app/src/main/jni/nfd-wrapper.cpp#L58).
We need to figure out where settings can be stored (e.g., content store size; default strategy choices, udp/tcp face system parameters) and how they should be passed to the wrapper.
Updated by Ivan Yeo over 9 years ago
Hey Alex,
Just off the top of my head, 2 possibilities came to mind:
Asset File
One way is to have the configurations in a file present in the asset/ directory of the Android project. This way, the app can read in the data from the file and pass it as a string argument when starting the NFD.Asset Directory
The other way is for the NFD to read directly from the configuration file in the asset/ directory.
Cheers,
Ivan
Updated by Alex Afanasyev over 9 years ago
No, this shouldn't be "configuration file". The only thing I want to do is to pass some in-memory structure from java to c++. What exactly this memory structure is depends on what settings we actually want to configure and how exactly this information is stored on java side (can it be List<> of some kind?)
Updated by Ivan Yeo over 9 years ago
On Java's side there shouldn't be too much of an issue. I'm thinking that List<>, Map<> and the likes will all work. We can even have custom classes that are made Serializable or Parcelable for storage or passing around between Activities, etc. However, the passing to C++ can be tricky depending on your requirements. I usually do it as simple strings with fixed delimiters and parse it at the native layer.
If this does not meet your requirement, there are other methods that I know of, like mapping of a class in Java with that of a C struct. However, this is very mechanical and there are some tools to assist us in speeding up this process, such as: https://code.google.com/p/jnaerator/
Updated by Alex Afanasyev over 9 years ago
- Status changed from Code review to In Progress
- % Done changed from 60 to 90
- Parent task set to #1989
Updated by Alex Afanasyev over 9 years ago
- Related to Feature #2746: Allow configuration of NFD parameters added
Updated by Alex Afanasyev over 9 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100