-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from RoyARG02/ver2
Migrate version 2 to master
- Loading branch information
Showing
58 changed files
with
1,717 additions
and
1,127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ample/soil_moisture_app/MainActivity.java → ...n/java/com/isocode/soif/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,12 @@ | ||
// * Import all Data Classes | ||
import 'package:soil_moisture_app/data/plant_class.dart'; | ||
import 'package:soil_moisture_app/data/temp_class.dart'; | ||
import 'package:soil_moisture_app/data/humidity_class.dart'; | ||
import 'package:soil_moisture_app/data/light_class.dart'; | ||
import 'package:soil_moisture_app/data/threshold_class.dart'; | ||
import 'package:soif/data/plant_data.dart'; | ||
import 'package:soif/data/threshold_class.dart'; | ||
|
||
// * Define Data Objects to be used throughout the app | ||
List<Plant> plantList = []; | ||
Light dayLight; | ||
Temp dayTemp; | ||
Humidity dayHumid; | ||
// * Data Object to be used throughout the app | ||
AllData allData; | ||
|
||
// * Latest Data objects to be used in Overview | ||
List<Plant> nowPlantList = []; | ||
Light nowLight; | ||
Temp nowTemp; | ||
Humidity nowHumid; | ||
// * Data object to be used in Overview | ||
NowData nowData; | ||
|
||
// * for threshold | ||
List<Threshold> pumpList = []; | ||
|
||
// * base url for application get/post | ||
final baseUrl = "https://soif.herokuapp.com"; | ||
|
||
// * Url for github repo | ||
final repoUrl = 'https://github.com/RoyARG02/soil_moisture_app'; | ||
|
||
// * Uri for API | ||
final apiUrl = 'https://github.com/forkbomb-666/drip_irrigation_server'; | ||
|
||
// * Developer Details | ||
final List<Map<String, dynamic>> devDetails = [ | ||
{ | ||
'Name': 'ANURAG ROY', | ||
'Github': 'RoyARG02', | ||
'Bio': 'Programming language nomad, and a Flutter developer.', | ||
'Twitter': '_royarg' | ||
}, | ||
{ | ||
'Name': 'AYUSH THAKUR', | ||
'Github': 'ayulockin', | ||
'Bio': 'Deep Learning for Computer Vision | Computer Vision for Robotics', | ||
'Twitter': 'ayushthakur0' | ||
}, | ||
{ | ||
'Name': 'SNEHANGSHU BHATTACHARYA', | ||
'Github': 'forkbomb-666', | ||
'Bio': 'Linux | Bigdata(Hadoop) | DIY Electronics | Robotics', | ||
'Twitter': 'snehangshu_' | ||
}, | ||
{ | ||
'Name': 'ARITRA ROY GOSTHIPATY', | ||
'Github': 'ariG23498', | ||
'Bio': '| Flutter | Android | Algorithms | Digital Signal Processing |', | ||
'Twitter': 'ariG23498' | ||
} | ||
]; | ||
// * For threshold | ||
List<Threshold> pumpList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
abstract class EnvironmentData { | ||
static const INVALID_VALUE = -999; //for data fields not consisting of lists | ||
List<num> _values; | ||
num _latest; | ||
String _unit; | ||
|
||
set setAllValues(List<num> values) { | ||
this._values = values; | ||
this._latest = values.isEmpty ? INVALID_VALUE : values.last; | ||
} | ||
|
||
set setLatestValue(num value) { | ||
this._latest = value ?? INVALID_VALUE; | ||
} | ||
|
||
set setUnit(String unit) => this._unit = unit; | ||
|
||
List<num> get allValues => this._values; | ||
num get lastValue => this._latest; | ||
String get unit => this._unit; | ||
|
||
@override | ||
String toString() { | ||
return '${this._latest}${this._unit}: ${this._values}'; | ||
} | ||
} | ||
|
||
class Moisture extends EnvironmentData { | ||
Moisture() { | ||
this._unit = '%'; | ||
} | ||
|
||
Moisture.latest() { | ||
this._unit = '%'; | ||
this._values = null; | ||
} | ||
} | ||
|
||
class Humidity extends EnvironmentData { | ||
Humidity() { | ||
this._unit = '%'; | ||
} | ||
|
||
Humidity.latest() { | ||
this._unit = '%'; | ||
this._values = null; | ||
} | ||
} | ||
|
||
class Temp extends EnvironmentData { | ||
Temp() { | ||
this._unit = '°C'; | ||
} | ||
|
||
Temp.latest() { | ||
this._unit = '°C'; | ||
this._values = null; | ||
} | ||
} | ||
|
||
class Light extends EnvironmentData { | ||
Light() { | ||
this._unit = 'Lx'; | ||
} | ||
|
||
Light.latest() { | ||
this._unit = 'Lx'; | ||
this._values = null; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,39 @@ | ||
import 'package:soif/data/environment_data.dart'; | ||
|
||
/* | ||
* Plant Class | ||
* This class contains the 24 hr values of moisture of a plant in any day | ||
*/ | ||
class Plant { | ||
// * Plant name | ||
String _label = 'Plant'; | ||
|
||
// * List containing the values of moisture for every hour | ||
List<num> _values; | ||
|
||
// * Moisture of last hour/ latest hour | ||
num _latestVal; | ||
|
||
// * Unit to be displayed alongside the value | ||
final String _unit = '%'; | ||
class Plant { | ||
static const double _moreThanNormal = 0.75; | ||
static const double _critMoisture = 0.35; | ||
String _name; | ||
Moisture _moisture; | ||
Plant(this._name, List<dynamic> values) { | ||
this._moisture = Moisture() | ||
..setAllValues = | ||
values.map<num>((v) => double.parse(v.toString())).toList(); | ||
} | ||
Plant.latest(this._name, num value) { | ||
this._moisture = Moisture.latest()..setLatestValue = value; | ||
} | ||
|
||
// * Moisture percentage above which the plant is assumed to have sufficient moisture | ||
final double _moreThanNormal = 0.75; | ||
// * Moisture percentage below which the plant is assumed to have low moisture | ||
final double _critMoisture = 0.35; | ||
String get name => this._name; | ||
Moisture get moisture => this._moisture; | ||
|
||
// * Determines if 'this' plant (or any given moisture value) is low or not | ||
bool isCritical([double check]) { | ||
check = check ?? this.getLastValue; | ||
check = check ?? this._moisture.lastValue; | ||
return (check <= _critMoisture); | ||
} | ||
|
||
// * Determines if 'this' plant (or any given moisture value) is sufficient or not | ||
bool isMoreThanNormal([double check]) { | ||
check = check ?? this.getLastValue; | ||
check = check ?? this._moisture.lastValue; | ||
return (check >= _moreThanNormal); | ||
} | ||
|
||
Plant(this._values); | ||
|
||
// * Creates object with all values given(used in fetching total data) | ||
Plant.createElement(this._label, this._values); | ||
|
||
// * Creates object with only the latest value given(used in fetching current data) | ||
Plant.createLatest(this._label, this._latestVal); | ||
|
||
String get getLabel => _label; | ||
List<num> get getAllValues => _values; | ||
num get getLastValue => (this._values == null) ? _latestVal : _values.last; | ||
String get getUnit => this._unit; | ||
@override | ||
String toString() { | ||
return '${this._name} => ${this._moisture}'; | ||
} | ||
} |
Oops, something went wrong.