Skip to content

Commit 3b9e7ea

Browse files
authored
Merge pull request #1933 from fossasia/development
chore: merge development branch into master
2 parents 21b6906 + a91c544 commit 3b9e7ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1878
-197
lines changed

.github/release-drafter.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name-template: 'PSLab Version $NEXT_PATCH_VERSION'
2+
tag-template: 'v$NEXT_PATCH_VERSION'
3+
change-template: '- $TITLE (#$NUMBER) - @$AUTHOR'
4+
categories:
5+
- title: ':rocket: Features and Enhancements'
6+
labels:
7+
- 'Feature'
8+
- 'Enhancement'
9+
- title: ':bug: Bug Fixes'
10+
label: 'Fix'
11+
- title: ':wrench: Maintenance'
12+
label: 'Chore'
13+
- title: ':page_facing_up: Documentation'
14+
label: 'Documentation'
15+
template: |-
16+
## Changes
17+
$CHANGES
18+
19+
This release was made possible thanks to $CONTRIBUTORS

README.md

+36-23
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](https://groups.google.com/forum/#!forum/pslab-fossasia)
1010
[![Twitter Follow](https://img.shields.io/twitter/follow/pslabio.svg?style=social&label=Follow&maxAge=2592000?style=flat-square)](https://twitter.com/pslabio)
1111

12+
![Minimum API Level](https://img.shields.io/badge/Min%20API%20Level-23-green)
13+
![Maximum API Level](https://img.shields.io/badge/Max%20API%20Level-28-orange)
14+
![GitHub repo size](https://img.shields.io/github/repo-size/fossasia/pslab-android)
15+
1216
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
1317

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

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

2529
## Screenshots
2630

@@ -54,8 +58,8 @@ Please join us on the following channels:
5458
</table>
5559
<table>
5660
<tr>
57-
<td><img src="/docs/images/instrument_wavegenerator_view.png"></td>
58-
<td><img src="/docs/images/instrument_logic_analyzer_view.png"></td>
61+
<td><img src="/docs/images/instrument_wave_generator_analog.png"></td>
62+
<td><img src="/docs/images/instrument_wave_generator_digital.png"></td>
5963
</tr>
6064
</table>
6165
<table>
@@ -82,7 +86,8 @@ Please join us on the following channels:
8286
</table>
8387
<table>
8488
<tr>
85-
<td><img src="/docs/images/instrument_robotic_arm_view.png" width = "500"></td>
89+
<td><img src="/docs/images/instrument_robotic_arm_view.png" width = "1000"/></td>
90+
<td><img src="/docs/images/instrument_logic_analyzer_view.png"/></td>
8691
</tr>
8792
</table>
8893

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

95100
## Features
96-
| **Feature** | **Description** | **Status** |
97-
|------------------|-------------------------------------------------------|-----------------|
98-
| Home Screen | Show status and version of PSLab device ||
99-
| Instruments | Exposes PSLab instruments like Oscilloscope, etc ||
100-
| Oscilloscope | Shows variation of analog signals ||
101-
| Multimeter | Measures voltage, current, resistance and capacitance ||
102-
| Logical Analyzer | Captures and displays signals from digital system ||
103-
| Wave Generator | Generates arbitrary analog and digital waveforms ||
104-
| Power Source | Generates programmable voltage and currents ||
105-
| Lux Meter | Measures the ambient light intensity ||
106-
| Baro Meter | Measures the Pressure ||
107-
| AcceleroMeter | Measures the acceleration of the device ||
108-
| Gyro Meter | Measures the rate of rotation ||
109-
| Compass | Measures the absolute rotation relative to earth magnetic poles ||
110-
| Thermometer | Measures the ambient temperature | |
111-
| Robotic Arm Controller | Allows to control 4 servo motors of the robotic arm | |
101+
| **Feature** | **Description** | **Status** |
102+
|------------------------|-------------------------------------------------------------------|--------------------|
103+
| Home Screen | Show status and version of PSLab device | :heavy_check_mark: |
104+
| Instruments | Exposes PSLab instruments like Oscilloscope, etc | :heavy_check_mark: |
105+
| Oscilloscope | Shows variation of analog signals | :heavy_check_mark: |
106+
| Multimeter | Measures voltage, current, resistance and capacitance | :heavy_check_mark: |
107+
| Logical Analyzer | Captures and displays signals from digital system | :heavy_check_mark: |
108+
| Wave Generator | Generates arbitrary analog and digital waveforms | :heavy_check_mark: |
109+
| Power Source | Generates programmable voltage and currents | :heavy_check_mark: |
110+
| Lux Meter | Measures the ambient light intensity | :heavy_check_mark: |
111+
| Baro Meter | Measures the Pressure | :heavy_check_mark: |
112+
| AcceleroMeter | Measures the acceleration of the device | :heavy_check_mark: |
113+
| Gyro Meter | Measures the rate of rotation | :heavy_check_mark: |
114+
| Compass | Measures the absolute rotation relative to earth magnetic poles | :heavy_check_mark: |
115+
| Thermometer | Measures the ambient temperature | :heavy_check_mark: |
116+
| Gas Sensor | Detects gases, including NH3, NOx, alcohol, benzene, smoke and CO2| :heavy_check_mark: |
117+
| Robotic Arm Controller | Allows to control 4 servo motors of the robotic arm independently | :heavy_check_mark: |
118+
112119
## How to set up the Android app in your development environment
113120

114-
Minimum Android version 5.0 (API Level 21)
115121

116-
Maximum Android version 8.1 (API Level 27)
122+
### Application Flavors
123+
124+
There are 2 flavors (build variants) of PSLab Android application.
125+
126+
1. #### Play Store Flavor
127+
- Play Store flavor uses Google Maps to display location stored in logs in Data logger.
128+
2. #### Fdroid Flavors
129+
- Fdroid flavor uses Open Street Maps to display location stored in logs in Data logger.
117130

118131
### Development Setup
119132

app/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
applicationId "io.pslab"
1414
minSdkVersion rootProject.ext.minSdkVersion
1515
targetSdkVersion rootProject.ext.targetSdkVersion
16-
versionCode 18
17-
versionName "2.0.17"
16+
versionCode 19
17+
versionName "2.0.18"
1818
multiDexEnabled true
1919
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2020
}
@@ -107,6 +107,8 @@ dependencies {
107107
implementation 'com.github.GoodieBag:ProtractorView:v1.2'
108108
implementation 'com.github.Triggertrap:SeekArc:v1.1'
109109

110+
implementation "com.squareup.okhttp3:okhttp:$rootProject.okHttpVersion"
111+
110112
implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
111113
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
112114

app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
<activity
100100
android:name=".activity.GyroscopeActivity"
101101
android:screenOrientation="portrait" />
102+
<activity
103+
android:name=".activity.GasSensorActivity"
104+
android:screenOrientation="portrait" />
102105
<activity android:name=".activity.MapsActivity" />
103106

104107
<receiver android:name=".receivers.USBDetachReceiver" />

app/src/main/java/io/pslab/activity/DataLoggerActivity.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
import io.pslab.models.AccelerometerData;
3535
import io.pslab.models.BaroData;
3636
import io.pslab.models.CompassData;
37+
import io.pslab.models.GasSensorData;
3738
import io.pslab.models.GyroData;
39+
import io.pslab.models.LogicAnalyzerData;
3840
import io.pslab.models.LuxData;
3941
import io.pslab.models.OscilloscopeData;
4042
import io.pslab.models.PowerSourceData;
@@ -120,6 +122,12 @@ protected void onCreate(Bundle savedInstanceState) {
120122
case "Power Source":
121123
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getResources().getString(R.string.power_source));
122124
break;
125+
case "Logic Analyzer":
126+
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getResources().getString(R.string.logical_analyzer));
127+
break;
128+
case "Gas Sensor":
129+
categoryData = LocalDataLog.with().getTypeOfSensorBlocks(getString(R.string.gas_sensor));
130+
break;
123131
default:
124132
categoryData = LocalDataLog.with().getAllSensorBlocks();
125133
getSupportActionBar().setTitle(getString(R.string.logged_data));
@@ -253,7 +261,7 @@ private RealmObject getObject(String objectType, String[] data, long time, long
253261
returnObject = new LuxData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
254262
break;
255263
case "Barometer":
256-
returnObject = new BaroData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
264+
returnObject = new BaroData(time, block, Float.valueOf(data[2]), Float.valueOf(data[3]), Double.valueOf(data[4]), Double.valueOf(data[5]));
257265
break;
258266
case "Accelerometer":
259267
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]));
@@ -279,6 +287,12 @@ private RealmObject getObject(String objectType, String[] data, long time, long
279287
case "Power Source":
280288
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]));
281289
break;
290+
case "Logic Analyzer":
291+
returnObject = new LogicAnalyzerData(time, block, data[2], Integer.valueOf(data[3]), data[4], data[5], Float.valueOf(data[6]), Float.valueOf(data[7]));
292+
break;
293+
case "Gas Sensor":
294+
returnObject = new GasSensorData(time, block, Float.valueOf(data[2]), Double.valueOf(data[3]), Double.valueOf(data[4]));
295+
break;
282296
default:
283297
returnObject = null;
284298
break;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package io.pslab.activity;
2+
3+
import android.content.SharedPreferences;
4+
import android.support.v4.app.Fragment;
5+
6+
import io.pslab.R;
7+
import io.pslab.fragment.GasSensorDataFragment;
8+
import io.pslab.models.GasSensorData;
9+
import io.pslab.models.PSLabSensor;
10+
import io.pslab.models.SensorDataBlock;
11+
import io.pslab.others.LocalDataLog;
12+
import io.realm.RealmObject;
13+
import io.realm.RealmResults;
14+
15+
public class GasSensorActivity extends PSLabSensor {
16+
17+
private static final String PREF_NAME = "customDialogPreference";
18+
public RealmResults<GasSensorData> recordedGasSensorData;
19+
20+
@Override
21+
public int getMenu() {
22+
return R.menu.sensor_data_log_menu;
23+
}
24+
25+
@Override
26+
public SharedPreferences getStateSettings() {
27+
return this.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
28+
29+
}
30+
31+
@Override
32+
public String getFirstTimeSettingID() {
33+
return "GasSensorFirstTime";
34+
}
35+
36+
@Override
37+
public String getSensorName() {
38+
return getResources().getString(R.string.gas_sensor);
39+
}
40+
41+
@Override
42+
public int getGuideTitle() {
43+
return R.string.gas_sensor;
44+
}
45+
46+
@Override
47+
public int getGuideAbstract() {
48+
return R.string.gas_sensor;
49+
}
50+
51+
@Override
52+
public int getGuideSchematics() {
53+
return R.drawable.bmp180_schematic;
54+
}
55+
56+
@Override
57+
public int getGuideDescription() {
58+
return R.string.gas_sensor;
59+
}
60+
61+
@Override
62+
public int getGuideExtraContent() {
63+
return 0;
64+
}
65+
66+
@Override
67+
public void recordSensorDataBlockID(SensorDataBlock block) {
68+
realm.beginTransaction();
69+
realm.copyToRealm(block);
70+
realm.commitTransaction();
71+
}
72+
73+
@Override
74+
public void recordSensorData(RealmObject sensorData) {
75+
realm.beginTransaction();
76+
realm.copyToRealm((GasSensorData) sensorData);
77+
realm.commitTransaction();
78+
}
79+
80+
@Override
81+
public void stopRecordSensorData() {
82+
LocalDataLog.with().refresh();
83+
}
84+
85+
@Override
86+
public Fragment getSensorFragment() {
87+
return GasSensorDataFragment.newInstance();
88+
}
89+
90+
@Override
91+
public void getDataFromDataLogger() {
92+
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
93+
viewingData = true;
94+
recordedGasSensorData = LocalDataLog.with()
95+
.getBlockOfGasSensorRecords(getIntent().getExtras().getLong(DATA_BLOCK));
96+
String title = titleFormat.format(recordedGasSensorData.get(0).getTime());
97+
getSupportActionBar().setTitle(title);
98+
}
99+
}
100+
}

app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.support.design.widget.BottomSheetBehavior;
1010
import android.support.v7.app.AppCompatActivity;
1111
import android.support.v7.widget.Toolbar;
12-
import android.support.v7.widget.TooltipCompat;
1312
import android.view.GestureDetector;
1413
import android.view.MenuItem;
1514
import android.view.MotionEvent;
@@ -23,12 +22,15 @@
2322
import io.pslab.R;
2423
import io.pslab.communication.ScienceLab;
2524
import io.pslab.fragment.LALogicLinesFragment;
25+
import io.pslab.models.LogicAnalyzerData;
26+
import io.pslab.others.LocalDataLog;
2627
import io.pslab.others.MathUtils;
2728
import io.pslab.others.ScienceLabCommon;
2829

2930
import butterknife.BindView;
3031
import butterknife.ButterKnife;
3132
import io.pslab.others.SwipeGestureDetector;
33+
import io.realm.RealmResults;
3234

3335
/**
3436
* Created by viveksb007 on 10/5/17.
@@ -56,6 +58,11 @@ public class LogicalAnalyzerActivity extends AppCompatActivity {
5658
private GestureDetector gestureDetector;
5759
private TextView showText;
5860
private boolean btnLongpressed;
61+
private final String KEY_LOG = "has_log";
62+
private final String DATA_BLOCK = "data_block";
63+
public boolean isPlayback = false;
64+
public RealmResults<LogicAnalyzerData> recordedLAData;
65+
5966

6067
@Override
6168
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -124,6 +131,12 @@ public boolean onTouch(View v, MotionEvent event) {
124131
return true;
125132
}
126133
});
134+
135+
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
136+
recordedLAData = LocalDataLog.with()
137+
.getBlockOfLARecords(getIntent().getExtras().getLong(DATA_BLOCK));
138+
isPlayback = true;
139+
}
127140
}
128141

129142
@Override

0 commit comments

Comments
 (0)