void berFramingOutput_init(BerFramingOutput *pThis,
                           byte *pMemory,
                           unsigned int size,
                           byte slotId,
                           byte dtd,
                           const byte *pAppBytes,
                           byte appBytesCount)
{
   ASSERT(pThis != NULL);
   ASSERT(size <= EMBER_MAXIMUM_PACKAGE_LENGTH);

   if(size > EMBER_MAXIMUM_PACKAGE_LENGTH)
      size = EMBER_MAXIMUM_PACKAGE_LENGTH;

   bzero(*pThis);
   berMemoryOutput_init(&pThis->base, pMemory, size);

   pThis->base.base.writeByte = berFramingOutput_writeByte;
   pThis->base.base.writeBytes = berFramingOutput_writeBytes;

   pThis->crc = 0xFFFF;
   pThis->slotId = slotId;
   pThis->dtd = dtd;

   pThis->pAppBytes = pAppBytes;
   pThis->appBytesCount = appBytesCount;
}
Exemple #2
0
void ember_writeReal(BerOutput *pOut, const BerTag *pTag, double value)
{
   BerMemoryOutput out;
   byte buffer[20];
   int valueLength;

   ASSERT(pOut != NULL);
   ASSERT(pTag != NULL);

   berMemoryOutput_init(&out, buffer, sizeof(buffer));

   valueLength = ber_encodeReal(&out.base, value);
   writeOuterHeader(pOut, pTag, valueLength + 2);
   writeTypeTag(pOut, BerType_Real, false);
   ber_encodeLength(pOut, valueLength);
   pOut->writeBytes(pOut, out.pMemory, valueLength);
}