Ejemplo n.º 1
0
SSP1::SSP1()			//define constructor
{
	this->port = LPCXSSP1;
	bitOrder = LSBFIRST;
	divider = SPI_CLOCK_DIV4;	//Arduino's default
	dataMode = SPI_MODE0;
	bitlength = 8;
	setClockDivider(divider);
	setBitLength(bitlength);
	setBitOrder(LSBFIRST);
	begin();
}
StaticVoyageRelatedmsg::StaticVoyageRelatedmsg(std::string parseMsg): AISmsg(parseMsg){
    setBitLength(424);
    ais_version = getUBits(parseMsg, 38, 2);
    imo = getUBits(parseMsg, 40, 30);
    callsign = getStringBits(parseMsg, 70, 42);
    shipname = getStringBits(parseMsg, 112, 120);
    setShiptype((AISmsg::ShipType)getUBits(parseMsg, 232, 8));
    to_bow = getUBits(parseMsg, 240, 9);
    to_stern = getUBits(parseMsg, 249, 9);
    to_port = getUBits(parseMsg, 258, 6);
    to_starboard = getUBits(parseMsg, 264, 6);
    setEPFD((AISmsg::PositionFixType)getUBits(parseMsg, 270, 4));
    month = getUBits(parseMsg, 274, 4);
    day = getUBits(parseMsg, 278, 5);
    hour = getUBits(parseMsg, 283, 5);
    minute = getUBits(parseMsg, 288, 6);
    draught = getUBits(parseMsg, 294, 8);
    destination = getStringBits(parseMsg, 302, 120);
    dte = getUBits(parseMsg, 422, 1);
}
StaticVoyageRelatedmsg::StaticVoyageRelatedmsg(unsigned int mmsi): AISmsg(mmsi){
    setBitLength(424);
    ais_version = 0;
    imo = 0;
    callsign = "";
    shipname = "";
    shiptype = AISmsg::SHIP_TYPE_NOT_AVAILABLE;
    to_bow = 0;
    to_stern = 0;
    to_port = 0;
    to_starboard = 0;
    epfd = AISmsg::POSITION_FIX_UNDEFINED;
    month = 0;
    day = 0;
    hour = 24;
    minute = 60;
    draught = 0;
    destination = "";
    dte = false;
}