Пример #1
0
        static Offset <FByteArray> build_byte_array(FlatBufferBuilder b, IHasByteArray camera)
        {
            var v_offset = FByteArray.CreateBytesVector(b, camera.Bytes);

            FByteArray.StartFByteArray(b);
            FByteArray.AddType(b, FByteDataType.PNG);
            FByteArray.AddBytes(b, v_offset);
            return(FByteArray.EndFByteArray(b));
        }
Пример #2
0
        static Offset <FByteArray> Serialise(FlatBufferBuilder b, IHasByteArray sensor)
        {
            var v_offset = FByteArray.CreateBytesVectorBlock(b, sensor.Bytes);
            //var v_offset = CustomFlatBufferImplementation.CreateByteVector(b, camera.Bytes);
            FByteDataType a;

            switch (sensor.ArrayEncoding)
            {
            case "UINT8":
                a = FByteDataType.UINT8;
                break;

            case "FLOAT16":
                a = FByteDataType.FLOAT16;
                break;

            case "FLOAT32":
                a = FByteDataType.FLOAT32;
                break;

            case "JPEG":
                a = FByteDataType.JPEG;
                break;

            case "PNG":
                a = FByteDataType.PNG;
                break;

            default:
                a = FByteDataType.Other;
                break;
            }

            var c = FByteArray.CreateShapeVector(b, sensor.Shape);

            FByteArray.StartFByteArray(b);
            FByteArray.AddType(b, a);
            FByteArray.AddShape(b, c);
            FByteArray.AddBytes(b, v_offset);
            return(FByteArray.EndFByteArray(b));
        }