private static String getDirection(int angle)
{
String direction = "";
if(angle < 90)
{
direction = "东偏北" + (90 - angle) + "°";
}
if(angle > 90 && angle < 180)
{
direction = "东偏南" + (angle - 90) + "°";
}
if(angle > 180 && angle < 270)
{
direction = "西偏南" + (angle - 180) + "°";
}
if(angle > 270)
{
direction = "西偏北" + (angle - 270) + "°";
}
return direction;
}
public int getDirection(byte buff[])
{
int cardirection = 0;
cardirection = buff[0] * 256 + buff[1];
return cardirection;
}