-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jazmin Ferreiro
authored and
Jazmin Ferreiro
committed
Jul 19, 2021
1 parent
0262234
commit a8fa984
Showing
4 changed files
with
117 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,108 @@ | ||
class Movement { | ||
final String deviceId; | ||
final int eventNum; | ||
final double acc; | ||
final double gyro; | ||
Movement(this.deviceId, this.eventNum, this.acc, this.gyro); | ||
final Hand hand; | ||
|
||
Movement(this.deviceId, this.eventNum, this.hand); | ||
|
||
Movement.fromJson(Map<String, dynamic> json) | ||
: deviceId = json['device_id'], eventNum = json['event_num'], | ||
acc = json['acc'], gyro = json['gyro']; | ||
hand = Hand.fromJson(json['hand'] as Map<String, dynamic>); | ||
|
||
Map<String, dynamic> toJson() => { | ||
'device_id': deviceId, | ||
'event_num': eventNum, | ||
'acc': acc, | ||
'gyro': gyro, | ||
'hand': hand.toJson(), | ||
}; | ||
} | ||
|
||
|
||
class Hand { | ||
final Finger thump; | ||
/* | ||
final Finger index; | ||
final Finger middle; | ||
final Finger ring; | ||
final Finger pinky; | ||
*/ | ||
|
||
Hand(this.thump); | ||
|
||
Hand.fromJson(Map<String, dynamic> json) | ||
: thump = Finger.fromJson(json['thump'] as Map<String, dynamic>); | ||
|
||
Map<String, dynamic> toJson() => { | ||
'thump': thump.toJson(), | ||
}; | ||
|
||
} | ||
|
||
class Finger { | ||
final Acceleration acc; | ||
final Gyro gyro; | ||
final Inclination inclination; | ||
|
||
Finger(this.acc, this.gyro, this.inclination); | ||
|
||
Finger.fromJson(Map<String, dynamic> json) | ||
: acc = Acceleration.fromJson(json['acc'] as Map<String, dynamic>), | ||
gyro = Gyro.fromJson(json['gyro'] as Map<String, dynamic>), | ||
inclination = Inclination.fromJson(json['inclination']as Map<String, dynamic>); | ||
Map<String, dynamic> toJson() => { | ||
'acc': acc.toJson(), | ||
'gyro': gyro.toJson(), | ||
'inclination': inclination.toJson(), | ||
}; | ||
|
||
} | ||
class Acceleration { | ||
final double x; | ||
final double y; | ||
final double z; | ||
|
||
Acceleration(this.x, this.y, this.z); | ||
|
||
Acceleration.fromJson(Map<String, dynamic> json) | ||
: x = json['x'], y = json['y'], z = json['z']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'x': x, | ||
'y': y, | ||
'z': z, | ||
}; | ||
} | ||
|
||
class Gyro { | ||
final double x; | ||
final double y; | ||
final double z; | ||
Gyro (this.x, this.y, this.z); | ||
|
||
Gyro .fromJson(Map<String, dynamic> json) | ||
: x = json['x'], y = json['y'], z = json['z']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'x': x, | ||
'y': y, | ||
'z': z, | ||
}; | ||
} | ||
} | ||
|
||
class Inclination { | ||
final double roll; | ||
final double pitch; | ||
final double yaw; | ||
Inclination(this.roll, this.pitch, this.yaw); | ||
|
||
Inclination.fromJson(Map<String, dynamic> json) | ||
: roll = json['roll'], pitch = json['pitch'], yaw = json['yaw']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'roll': roll, | ||
'pitch': pitch, | ||
'yaw': yaw, | ||
}; | ||
|
||
} | ||
|
||
|
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