funf-org / funf-core-android

Funf Open Sensing Framework for Android
92 stars 53 forks source link

Pipeline.getDb() funf v0.5 not compatible with funf v0.4 #113

Open shixudongleo opened 8 years ago

shixudongleo commented 8 years ago

I am learning to use funf by the wifiscanner sample, which is based on funf v0.4.

I have to use funf v0.5, because later I need to use VideoCaptureProbe, which is not developed in funf v0.4.

When using funf v0.5 jar in wifiscanner, Pipeline.getDb() is missing. How to fix it?

  private void updateScanCount() {
    // Query the pipeline db for the count of rows in the data table
    SQLiteDatabase db = pipeline.getDb();
    Cursor mcursor = db.rawQuery(TOTAL_COUNT_SQL, null);
    mcursor.moveToFirst();
    final int count = mcursor.getInt(0);
    // Update interface on main thread
    runOnUiThread(new Runnable() {
      @Override
      public void run() {
        dataCountView.setText("Data Count: " + count);
      }
    });
  }
ayalpani commented 8 years ago

Hi @shixudongleo, did you find a way to make things work? I currently have the exact same problem. Thanks

brijmohan commented 7 years ago

I have created a pull request https://github.com/funf-org/funf-core-android/pull/116

Merge it with your local repository to get the DBHelper instance from the pipeline. You can get the instance of DB like this then:

SQLiteDatabase db = pipeline.getDbHelper().getWritableDatabase();