Commit 3304abf6 authored by garciay's avatar garciay
Browse files

GeoNetworking codecs ongoing

Add GeoNetworkingLayer
parent 99930cfa
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -13,9 +13,11 @@ BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TestSystem::GeoNetworki
{
{
    loggers::loggers::log("fx__enc__GeoNetworkingReq");
    loggers::loggers::log("fx__enc__GeoNetworkingReq");
    GeoNetworkingCodec codec;
    GeoNetworkingCodec codec;
    OCTETSTRING os;
    const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu & pdu = p_geoNetworkingReq.msgOut();
    const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu & pdu = p_geoNetworkingReq.msgOut();
    OCTETSTRING os;
    codec.encode(pdu, os);
    codec.encode(pdu, os);
    const unsigned char mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    os += OCTETSTRING(sizeof(mac_address), static_cast<const unsigned char *>(mac_address));
    return oct2bit(os);
    return oct2bit(os);
}
}


@@ -28,8 +30,20 @@ BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TestSystem::GeoNetworki
INTEGER fx__dec__GeoNetworkingReq(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p)
INTEGER fx__dec__GeoNetworkingReq(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p)
{
{
    loggers::loggers::log("fx__dec__GeoNetworkingReq");
    loggers::loggers::log("fx__dec__GeoNetworkingReq");
    GeoNetworkingCodec codec;
    LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu pdu;
    OCTETSTRING is = bit2oct(b);

    if (codec.decode(OCTETSTRING(is.lengthof() - 6, static_cast<const unsigned char *>(is)), pdu) == -1) {
    	return -1;
    	return -1;
    }
    }
    const unsigned char mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    p = LibItsGeoNetworking__TestSystem::GeoNetworkingReq(
    		pdu,
			OCTETSTRING(sizeof(mac_address), static_cast<const unsigned char *>(mac_address)),
            0);
    return 0;
}


/****************************************************
/****************************************************
 * @desc    External function to encode a GeoNetworkingInd type
 * @desc    External function to encode a GeoNetworkingInd type