forked from Ruslan-B/AR.Drone
-
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
Showing
9 changed files
with
125 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using AR.Drone.Data; | ||
|
||
namespace AR.Drone.Client | ||
{ | ||
public struct LedAnimation | ||
{ | ||
public LedAnimation(LedAnimationType type, float frequency, int duration) | ||
: this() | ||
{ | ||
Type = type; | ||
Frequency = frequency; | ||
Duration = duration; | ||
} | ||
|
||
public LedAnimationType Type { get; private set; } | ||
public float Frequency { get; private set; } | ||
public int Duration { get; private set; } | ||
|
||
public static LedAnimation Parse(string value) | ||
{ | ||
string[] parts = value.Split(','); | ||
var animation = new LedAnimation(); | ||
LedAnimationType type; | ||
int duration; | ||
int ifrequency; | ||
if (parts.Length > 2 && Enum.TryParse(parts[0], out type) && int.TryParse(parts[1], out ifrequency) | ||
&& int.TryParse(parts[2], out duration)) | ||
{ | ||
animation.Type = type; | ||
animation.Frequency = ConversionHelper.ToSingle(ifrequency); | ||
animation.Duration = duration; | ||
} | ||
return animation; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return string.Format("{0},{1},{2}", (int) Type, ConversionHelper.ToInt(Frequency), Duration); | ||
} | ||
} | ||
} | ||
|
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,30 @@ | ||
using System; | ||
|
||
namespace AR.Drone.Client | ||
{ | ||
public enum LedAnimationType | ||
{ | ||
BlinkGreenRed = 0, | ||
BlinkGreen, | ||
BlinkRed, | ||
BlinkOrange, | ||
SnakeGreenRed, | ||
Fire, | ||
Standard, | ||
Red, | ||
Green, | ||
RedSnake, | ||
Blank, | ||
RightMissile, | ||
LeftMissile, | ||
DoubleMissile, | ||
FrontLeftGreenOthersRed, | ||
FrontRightGreenOthersRed, | ||
RearRightGreenOthersRed, | ||
RearLeftGreenOthersRed, | ||
LeftGreenRightRed, | ||
LeftRedRightGreen, | ||
BlinkStandard | ||
} | ||
} | ||
|
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