Project

General

Profile

Actions

Task #2509

closed

Task #1989: Basic NFD control app for Android

Implement jni equivalent of daemon/main.cpp to start NFD/NRD

Added by Alex Afanasyev about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
jni
Target version:
Start date:
02/10/2015
Due date:
% Done:

100%

Estimated time:

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

Related issues 1 (1 open0 closed)

Related to NFD-android - Feature #2746: Allow configuration of NFD parametersNew

Actions
Actions #1

Updated by Alex Afanasyev about 9 years ago

Ivan, do you have suggestion on second item in the list?

Actions #2

Updated by Alex Afanasyev about 9 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 0 to 60
Actions #3

Updated by Alex Afanasyev about 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.

Actions #4

Updated by Ivan Yeo about 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

Actions #5

Updated by Alex Afanasyev about 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?)

Actions #6

Updated by Ivan Yeo about 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/

Actions #7

Updated by Alex Afanasyev about 9 years ago

  • Status changed from Code review to In Progress
  • % Done changed from 60 to 90
  • Parent task set to #1989
Actions #8

Updated by Alex Afanasyev about 9 years ago

  • Target version set to 0.1
Actions #9

Updated by Alex Afanasyev about 9 years ago

  • Related to Feature #2746: Allow configuration of NFD parameters added
Actions #10

Updated by Alex Afanasyev about 9 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF