Skip to content

Commit

Permalink
Merge pull request #1933 from fossasia/development
Browse files Browse the repository at this point in the history
chore: merge development branch into master
  • Loading branch information
CloudyPadmal authored Aug 15, 2019
2 parents 21b6906 + a91c544 commit 3b9e7ea
Show file tree
Hide file tree
Showing 43 changed files with 1,878 additions and 197 deletions.
19 changes: 19 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name-template: 'PSLab Version $NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
change-template: '- $TITLE (#$NUMBER) - @$AUTHOR'
categories:
- title: ':rocket: Features and Enhancements'
labels:
- 'Feature'
- 'Enhancement'
- title: ':bug: Bug Fixes'
label: 'Fix'
- title: ':wrench: Maintenance'
label: 'Chore'
- title: ':page_facing_up: Documentation'
label: 'Documentation'
template: |-
## Changes
$CHANGES
This release was made possible thanks to $CONTRIBUTORS
59 changes: 36 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](https://groups.google.com/forum/#!forum/pslab-fossasia)
[![Twitter Follow](https://img.shields.io/twitter/follow/pslabio.svg?style=social&label=Follow&maxAge=2592000?style=flat-square)](https://twitter.com/pslabio)

![Minimum API Level](https://img.shields.io/badge/Min%20API%20Level-23-green)
![Maximum API Level](https://img.shields.io/badge/Max%20API%20Level-28-orange)
![GitHub repo size](https://img.shields.io/github/repo-size/fossasia/pslab-android)

This repository holds the Android App for performing experiments with [PSLab](https://pslab.io/). PSLab is a tiny pocket science lab that provides an array of equipment for doing science and engineering experiments. It can function like an oscilloscope, waveform generator, frequency counter, programmable voltage and current source and also as a data logger. Our website is at https://pslab.io

## Communication
Expand All @@ -19,8 +23,8 @@ Please join us on the following channels:

## Roadmap
- [x] First we need to get communication between Android App and PSLab working.
- [ ] Implement Applications and expose PSLab Hardware functionality to the user.
- [ ] Implement Functionality to Perform Experiment using PSLab Hardware Device.
- [x] Implement Applications and expose PSLab Hardware functionality to the user.
- [ ] Implement wireless connectivity

## Screenshots

Expand Down Expand Up @@ -54,8 +58,8 @@ Please join us on the following channels:
</table>
<table>
<tr>
<td><img src="/docs/images/instrument_wavegenerator_view.png"></td>
<td><img src="/docs/images/instrument_logic_analyzer_view.png"></td>
<td><img src="/docs/images/instrument_wave_generator_analog.png"></td>
<td><img src="/docs/images/instrument_wave_generator_digital.png"></td>
</tr>
</table>
<table>
Expand All @@ -82,7 +86,8 @@ Please join us on the following channels:
</table>
<table>
<tr>
<td><img src="/docs/images/instrument_robotic_arm_view.png" width = "500"></td>
<td><img src="/docs/images/instrument_robotic_arm_view.png" width = "1000"/></td>
<td><img src="/docs/images/instrument_logic_analyzer_view.png"/></td>
</tr>
</table>

Expand All @@ -93,27 +98,35 @@ Please join us on the following channels:
- [Generating and Observing Waveforms Using Pocket Science Lab](https://www.youtube.com/watch?v=Ua9_OCR4p8Y)

## Features
| **Feature** | **Description** | **Status** |
|------------------|-------------------------------------------------------|-----------------|
| Home Screen | Show status and version of PSLab device ||
| Instruments | Exposes PSLab instruments like Oscilloscope, etc ||
| Oscilloscope | Shows variation of analog signals ||
| Multimeter | Measures voltage, current, resistance and capacitance ||
| Logical Analyzer | Captures and displays signals from digital system ||
| Wave Generator | Generates arbitrary analog and digital waveforms ||
| Power Source | Generates programmable voltage and currents ||
| Lux Meter | Measures the ambient light intensity ||
| Baro Meter | Measures the Pressure ||
| AcceleroMeter | Measures the acceleration of the device ||
| Gyro Meter | Measures the rate of rotation ||
| Compass | Measures the absolute rotation relative to earth magnetic poles ||
| Thermometer | Measures the ambient temperature | |
| Robotic Arm Controller | Allows to control 4 servo motors of the robotic arm | |
| **Feature** | **Description** | **Status** |
|------------------------|-------------------------------------------------------------------|--------------------|
| Home Screen | Show status and version of PSLab device | :heavy_check_mark: |
| Instruments | Exposes PSLab instruments like Oscilloscope, etc | :heavy_check_mark: |
| Oscilloscope | Shows variation of analog signals | :heavy_check_mark: |
| Multimeter | Measures voltage, current, resistance and capacitance | :heavy_check_mark: |
| Logical Analyzer | Captures and displays signals from digital system | :heavy_check_mark: |
| Wave Generator | Generates arbitrary analog and digital waveforms | :heavy_check_mark: |
| Power Source | Generates programmable voltage and currents | :heavy_check_mark: |
| Lux Meter | Measures the ambient light intensity | :heavy_check_mark: |
| Baro Meter | Measures the Pressure | :heavy_check_mark: |
| AcceleroMeter | Measures the acceleration of the device | :heavy_check_mark: |
| Gyro Meter | Measures the rate of rotation | :heavy_check_mark: |
| Compass | Measures the absolute rotation relative to earth magnetic poles | :heavy_check_mark: |
| Thermometer | Measures the ambient temperature | :heavy_check_mark: |
| Gas Sensor | Detects gases, including NH3, NOx, alcohol, benzene, smoke and CO2| :heavy_check_mark: |
| Robotic Arm Controller | Allows to control 4 servo motors of the robotic arm independently | :heavy_check_mark: |

## How to set up the Android app in your development environment

Minimum Android version 5.0 (API Level 21)

Maximum Android version 8.1 (API Level 27)
### Application Flavors

There are 2 flavors (build variants) of PSLab Android application.

1. #### Play Store Flavor
- Play Store flavor uses Google Maps to display location stored in logs in Data logger.
2. #### Fdroid Flavors
- Fdroid flavor uses Open Street Maps to display location stored in logs in Data logger.

### Development Setup

Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "io.pslab"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 18
versionName "2.0.17"
versionCode 19
versionName "2.0.18"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -107,6 +107,8 @@ dependencies {
implementation 'com.github.GoodieBag:ProtractorView:v1.2'
implementation 'com.github.Triggertrap:SeekArc:v1.1'

implementation "com.squareup.okhttp3:okhttp:$rootProject.okHttpVersion"

implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
<activity
android:name=".activity.GyroscopeActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.GasSensorActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.MapsActivity" />

<receiver android:name=".receivers.USBDetachReceiver" />
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/io/pslab/activity/DataLoggerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import io.pslab.models.AccelerometerData;
import io.pslab.models.BaroData;
import io.pslab.models.CompassData;
import io.pslab.models.GasSensorData;
import io.pslab.models.GyroData;
import io.pslab.models.LogicAnalyzerData;
import io.pslab.models.LuxData;
import io.pslab.models.OscilloscopeData;
import io.pslab.models.PowerSourceData;
Expand Down Expand Up @@ -120,6 +122,12 @@ protected void onCreate(Bundle savedInstanceState) {
case "Power Source":
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getResources().getString(R.string.power_source));
break;
case "Logic Analyzer":
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getResources().getString(R.string.logical_analyzer));
break;
case "Gas Sensor":
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getString(R.string.gas_sensor));
break;
default:
categoryData = LocalDataLog.with().getAllSensorBlocks();
getSupportActionBar().setTitle(getString(R.string.logged_data));
Expand Down Expand Up @@ -253,7 +261,7 @@ private RealmObject getObject(String objectType, String[] data, long time, long
returnObject = new LuxData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
break;
case "Barometer":
returnObject = new BaroData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
returnObject = new BaroData(time, block, Float.valueOf(data[2]), Float.valueOf(data[3]), Double.valueOf(data[4]), Double.valueOf(data[5]));
break;
case "Accelerometer":
returnObject = new AccelerometerData(time, block, Float.valueOf(data[2]), Float.valueOf(data[3]), Float.valueOf(data[4]), Double.valueOf(data[5]), Double.valueOf(data[6]));
Expand All @@ -279,6 +287,12 @@ private RealmObject getObject(String objectType, String[] data, long time, long
case "Power Source":
returnObject = new PowerSourceData(time, block, Float.valueOf(data[2]), Float.valueOf(data[3]), Float.valueOf(data[4]), Float.valueOf(data[5]), Float.valueOf(data[6]), Float.valueOf(data[7]));
break;
case "Logic Analyzer":
returnObject = new LogicAnalyzerData(time, block, data[2], Integer.valueOf(data[3]), data[4], data[5], Float.valueOf(data[6]), Float.valueOf(data[7]));
break;
case "Gas Sensor":
returnObject = new GasSensorData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
break;
default:
returnObject = null;
break;
Expand Down
100 changes: 100 additions & 0 deletions app/src/main/java/io/pslab/activity/GasSensorActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package io.pslab.activity;

import android.content.SharedPreferences;
import android.support.v4.app.Fragment;

import io.pslab.R;
import io.pslab.fragment.GasSensorDataFragment;
import io.pslab.models.GasSensorData;
import io.pslab.models.PSLabSensor;
import io.pslab.models.SensorDataBlock;
import io.pslab.others.LocalDataLog;
import io.realm.RealmObject;
import io.realm.RealmResults;

public class GasSensorActivity extends PSLabSensor {

private static final String PREF_NAME = "customDialogPreference";
public RealmResults<GasSensorData> recordedGasSensorData;

@Override
public int getMenu() {
return R.menu.sensor_data_log_menu;
}

@Override
public SharedPreferences getStateSettings() {
return this.getSharedPreferences(PREF_NAME, MODE_PRIVATE);

}

@Override
public String getFirstTimeSettingID() {
return "GasSensorFirstTime";
}

@Override
public String getSensorName() {
return getResources().getString(R.string.gas_sensor);
}

@Override
public int getGuideTitle() {
return R.string.gas_sensor;
}

@Override
public int getGuideAbstract() {
return R.string.gas_sensor;
}

@Override
public int getGuideSchematics() {
return R.drawable.bmp180_schematic;
}

@Override
public int getGuideDescription() {
return R.string.gas_sensor;
}

@Override
public int getGuideExtraContent() {
return 0;
}

@Override
public void recordSensorDataBlockID(SensorDataBlock block) {
realm.beginTransaction();
realm.copyToRealm(block);
realm.commitTransaction();
}

@Override
public void recordSensorData(RealmObject sensorData) {
realm.beginTransaction();
realm.copyToRealm((GasSensorData) sensorData);
realm.commitTransaction();
}

@Override
public void stopRecordSensorData() {
LocalDataLog.with().refresh();
}

@Override
public Fragment getSensorFragment() {
return GasSensorDataFragment.newInstance();
}

@Override
public void getDataFromDataLogger() {
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
viewingData = true;
recordedGasSensorData = LocalDataLog.with()
.getBlockOfGasSensorRecords(getIntent().getExtras().getLong(DATA_BLOCK));
String title = titleFormat.format(recordedGasSensorData.get(0).getTime());
getSupportActionBar().setTitle(title);
}
}
}
15 changes: 14 additions & 1 deletion app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.support.design.widget.BottomSheetBehavior;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v7.widget.TooltipCompat;
import android.view.GestureDetector;
import android.view.MenuItem;
import android.view.MotionEvent;
Expand All @@ -23,12 +22,15 @@
import io.pslab.R;
import io.pslab.communication.ScienceLab;
import io.pslab.fragment.LALogicLinesFragment;
import io.pslab.models.LogicAnalyzerData;
import io.pslab.others.LocalDataLog;
import io.pslab.others.MathUtils;
import io.pslab.others.ScienceLabCommon;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.pslab.others.SwipeGestureDetector;
import io.realm.RealmResults;

/**
* Created by viveksb007 on 10/5/17.
Expand Down Expand Up @@ -56,6 +58,11 @@ public class LogicalAnalyzerActivity extends AppCompatActivity {
private GestureDetector gestureDetector;
private TextView showText;
private boolean btnLongpressed;
private final String KEY_LOG = "has_log";
private final String DATA_BLOCK = "data_block";
public boolean isPlayback = false;
public RealmResults<LogicAnalyzerData> recordedLAData;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand Down Expand Up @@ -124,6 +131,12 @@ public boolean onTouch(View v, MotionEvent event) {
return true;
}
});

if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
recordedLAData = LocalDataLog.with()
.getBlockOfLARecords(getIntent().getExtras().getLong(DATA_BLOCK));
isPlayback = true;
}
}

@Override
Expand Down
Loading

0 comments on commit 3b9e7ea

Please sign in to comment.