// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.10.1
//   protoc               v3.21.12
// source: RGBDData.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { EncodedFrame } from "./EncodedFrame";
import { ImgFrame } from "./ImgFrame";
import { Timestamp } from "./common";
export const protobufPackage = "dai.proto.rgbd_data";
function createBaseRGBDData() {
    return {
        ts: undefined,
        tsDevice: undefined,
        sequenceNum: 0,
        colorImgFrame: undefined,
        colorEncodedFrame: undefined,
        depthImgFrame: undefined,
        depthEncodedFrame: undefined,
    };
}
export const RGBDData = {
    encode(message, writer = new BinaryWriter()) {
        if (message.ts !== undefined) {
            Timestamp.encode(message.ts, writer.uint32(10).fork()).join();
        }
        if (message.tsDevice !== undefined) {
            Timestamp.encode(message.tsDevice, writer.uint32(18).fork()).join();
        }
        if (message.sequenceNum !== 0) {
            writer.uint32(24).int64(message.sequenceNum);
        }
        if (message.colorImgFrame !== undefined) {
            ImgFrame.encode(message.colorImgFrame, writer.uint32(34).fork()).join();
        }
        if (message.colorEncodedFrame !== undefined) {
            EncodedFrame.encode(message.colorEncodedFrame, writer.uint32(42).fork()).join();
        }
        if (message.depthImgFrame !== undefined) {
            ImgFrame.encode(message.depthImgFrame, writer.uint32(50).fork()).join();
        }
        if (message.depthEncodedFrame !== undefined) {
            EncodedFrame.encode(message.depthEncodedFrame, writer.uint32(58).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRGBDData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.ts = Timestamp.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.tsDevice = Timestamp.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.sequenceNum = longToNumber(reader.int64());
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.colorImgFrame = ImgFrame.decode(reader, reader.uint32());
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    message.colorEncodedFrame = EncodedFrame.decode(reader, reader.uint32());
                    continue;
                }
                case 6: {
                    if (tag !== 50) {
                        break;
                    }
                    message.depthImgFrame = ImgFrame.decode(reader, reader.uint32());
                    continue;
                }
                case 7: {
                    if (tag !== 58) {
                        break;
                    }
                    message.depthEncodedFrame = EncodedFrame.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            ts: isSet(object.ts) ? Timestamp.fromJSON(object.ts) : undefined,
            tsDevice: isSet(object.tsDevice) ? Timestamp.fromJSON(object.tsDevice) : undefined,
            sequenceNum: isSet(object.sequenceNum) ? globalThis.Number(object.sequenceNum) : 0,
            colorImgFrame: isSet(object.colorImgFrame) ? ImgFrame.fromJSON(object.colorImgFrame) : undefined,
            colorEncodedFrame: isSet(object.colorEncodedFrame) ? EncodedFrame.fromJSON(object.colorEncodedFrame) : undefined,
            depthImgFrame: isSet(object.depthImgFrame) ? ImgFrame.fromJSON(object.depthImgFrame) : undefined,
            depthEncodedFrame: isSet(object.depthEncodedFrame) ? EncodedFrame.fromJSON(object.depthEncodedFrame) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.ts !== undefined) {
            obj.ts = Timestamp.toJSON(message.ts);
        }
        if (message.tsDevice !== undefined) {
            obj.tsDevice = Timestamp.toJSON(message.tsDevice);
        }
        if (message.sequenceNum !== 0) {
            obj.sequenceNum = Math.round(message.sequenceNum);
        }
        if (message.colorImgFrame !== undefined) {
            obj.colorImgFrame = ImgFrame.toJSON(message.colorImgFrame);
        }
        if (message.colorEncodedFrame !== undefined) {
            obj.colorEncodedFrame = EncodedFrame.toJSON(message.colorEncodedFrame);
        }
        if (message.depthImgFrame !== undefined) {
            obj.depthImgFrame = ImgFrame.toJSON(message.depthImgFrame);
        }
        if (message.depthEncodedFrame !== undefined) {
            obj.depthEncodedFrame = EncodedFrame.toJSON(message.depthEncodedFrame);
        }
        return obj;
    },
    create(base) {
        return RGBDData.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRGBDData();
        message.ts = (object.ts !== undefined && object.ts !== null) ? Timestamp.fromPartial(object.ts) : undefined;
        message.tsDevice = (object.tsDevice !== undefined && object.tsDevice !== null)
            ? Timestamp.fromPartial(object.tsDevice)
            : undefined;
        message.sequenceNum = object.sequenceNum ?? 0;
        message.colorImgFrame = (object.colorImgFrame !== undefined && object.colorImgFrame !== null)
            ? ImgFrame.fromPartial(object.colorImgFrame)
            : undefined;
        message.colorEncodedFrame = (object.colorEncodedFrame !== undefined && object.colorEncodedFrame !== null)
            ? EncodedFrame.fromPartial(object.colorEncodedFrame)
            : undefined;
        message.depthImgFrame = (object.depthImgFrame !== undefined && object.depthImgFrame !== null)
            ? ImgFrame.fromPartial(object.depthImgFrame)
            : undefined;
        message.depthEncodedFrame = (object.depthEncodedFrame !== undefined && object.depthEncodedFrame !== null)
            ? EncodedFrame.fromPartial(object.depthEncodedFrame)
            : undefined;
        return message;
    },
};
function longToNumber(int64) {
    const num = globalThis.Number(int64.toString());
    if (num > globalThis.Number.MAX_SAFE_INTEGER) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    if (num < globalThis.Number.MIN_SAFE_INTEGER) {
        throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
    }
    return num;
}
function isSet(value) {
    return value !== null && value !== undefined;
}
export const protobufName = "RGBDData";
//# sourceMappingURL=RGBDData.js.map