UNPKG

@br8kppooint/visca

Version:

Advanced nodejs library for working with VISCA-based PTZ cameras over IP and over serial connections.

339 lines 10.3 kB
"use strict"; /* This file gives semantic names to all Visca constants */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Constants = void 0; let Constants = { COMMAND_TIMEOUT: 200, // == HEADER == // masks for header components HEADERMASK_SOURCE: 0b01110000, HEADERMASK_RECIPIENT: 0b00000111, HEADERMASK_BROADCAST: 0b00001000, // == MESSAGE TYPE == // controller message categories (QQ from the spec) MSGTYPE_COMMAND: 0x01, MSGTYPE_IF_CLEAR: 0x01, MSGTYPE_INQUIRY: 0x09, MSGTYPE_CANCEL: 0x20, MSGTYPE_ADDRESS_SET: 0x30, // camera message types (QQ from the spec) MSGTYPE_NETCHANGE: 0x38, MSGTYPE_ACK: 0x40, MSGTYPE_COMPLETE: 0x50, MSGTYPE_ERROR: 0x60, // == DATA TYPE == // data types (RR from the spec) DATATYPE_INTERFACE: 0x00, DATATYPE_CAMERA: 0x04, DATATYPE_OPERATION: 0x06, // == COMMAND TYPE CONSTANTS == // camera settings codes // data (pqrs is in i2v format) CAM_POWER: 0x00, CAM_SLEEP_TIME: 0x40, CAM_ICR: 0x01, CAM_AUTO_ICR: 0x51, CAM_AUTO_ICR_THRESHOLD: 0x21, CAM_GAIN: 0x0C, CAM_GAIN_LIMIT: 0x2C, CAM_GAIN_DIRECT: 0x4C, CAM_RGAIN: 0x03, CAM_RGAIN_DIRECT: 0X43, CAM_BGAIN: 0x04, CAM_BGAIN_DIRECT: 0X44, CAM_ZOOM: 0x07, CAM_DZOOM: 0x06, CAM_ZOOM_DIRECT: 0x47, CAM_FOCUS: 0x08, CAM_FOCUS_IR_CORRECTION: 0x11, CAM_FOCUS_TRIGGER: 0x18, CAM_FOCUS_INFINITY: 0x18, CAM_FOCUS_NEAR_LIMIT_POS: 0x28, CAM_FOCUS_AUTO: 0x38, CAM_FOCUS_DIRECT: 0x48, CAM_FOCUS_AF_MODE: 0x57, CAM_FOCUS_AF_INTERVAL: 0x27, CAM_FOCUS_SENSE_HIGH: 0x58, CAM_WB_MODE: 0x35, CAM_WB_TRIGGER: 0x10, CAM_EXPOSURE_MODE: 0x39, CAM_SHUTTER_SLOW_AUTO: 0x5A, CAM_SHUTTER: 0x0A, CAM_SHUTTER_DIRECT: 0x4A, CAM_IRIS: 0x0B, CAM_IRIS_DIRECT: 0x4B, CAM_BRIGHT: 0x0D, CAM_BRIGHT_DIRECT: 0x4D, CAM_EXP_COMP: 0x0E, CAM_EXP_COMP_ENABLE: 0x3E, CAM_EXP_COMP_DIRECT: 0x4E, CAM_BACKLIGHT: 0x33, CAM_WIDE_D: 0x3D, CAM_WIDE_D_REFRESH: 0x10, CAM_WIDE_D_SET: 0x2D, // p: Screen display (0: Combined image, 2: Long-time, 3: Short-time) // q: Detection sensitivity (0: L 1: M 2: H) // r: Blocked-up shadow correction level (0: L 1: M 2: H 3: S) // s: Blown-out highlight correction level (0: L 1: M 2: H) // tu: Exposure ratio of short exposure (x1 to x64) CAM_APERTURE: 0x02, CAM_APERTURE_DIRECT: 0x42, CAM_HIRES_ENABLE: 0x52, CAM_NOISE_REDUCTION: 0x53, CAM_GAMMA: 0x5B, CAM_HIGH_SENSITIVITY: 0x5E, CAM_FREEZE: 0x62, CAM_EFFECT: 0x63, CAM_EFFECT_DIGITAL: 0x64, CAM_EFFECT_LEVEL: 0x65, CAM_MEMORY: 0x3F, CAM_ID_WRITE: 0x22, CAM_CHROMA_SUPPRESS: 0x5F, CAM_COLOR_GAIN: 0x49, CAM_COLOR_HUE: 0x4F, // operational settings OP_MENU_SCREEN: 0x06, OP_VIDEO_FORMAT: 0x35, OP_VIDEO_FORMAT_I_NOW: 0x23, OP_VIDEO_FORMAT_I_NEXT: 0x33, // These codes are camera specific. Sony camera codes are as follows here // p: // 0 = 1080i59.94, 1 = 1080p29.97, 2 = 720p59.94, 3 = 720p29.97, 4 = NTSC (not all cameras) // 8 = 1080i50, 9 = 720p50, A = 720p25, B = 1080i50, C = PAL (some cameras) // (I wonder if the manual intended to say B = 1080p50 ?) // video system changes require a power cycle OP_PAN_DRIVE: 0x01, OP_PAN_ABSOLUTE: 0x02, OP_PAN_RELATIVE: 0X03, OP_PAN_MAX_SPEED: 0x11, OP_PAN_POS: 0x12, OP_PAN_UP: 0x01, OP_PAN_DOWN: 0x2, OP_PAN_LEFT: 0X01, OP_PAN_RIGHT: 0X02, OP_PAN_NONE: 0x03, // VV: pan speed // WW: tilt speed // p: pan move 1-left, 2-right, 3-none // q: tilt move 1-up, 2-down, 3-none // YYYY: pan 4 bit signed value from E1E5 - 1E1B // ZZZZ: tilt 4 bit signed from FC75 to 0FF0 (flip off) or F010 to 038B (flip on) OP_PAN_HOME: 0x04, OP_PAN_RESET: 0x05, OP_PAN_LIMIT: 0x07, // W: 1 addresses the up-right limit, 0 addresses the down-left limit // to clear: 01 0W 07 0F 0F 0F 07 0F 0F 0F // to set: 00 0W 0Y 0Y 0Y 0Y 0Z 0Z 0Z 0Z OP_PAN_STATUS: 0x10, OP_IR_RECEIVE: 0x08, // special system commands (still need header and terminator) OP_IR_RETURN_ON: [0x01, 0x7D, 0x01, 0x03, 0x00, 0x00], OP_IR_RETURN_OFF: [0x01, 0x7D, 0x01, 0x13, 0x00, 0x00], OP_INFO_DISPLAY_ON: [0x01, 0x7E, 0x01, 0x18, 0x02], OP_INFO_DISPLAY_OFF: [0x01, 0x7E, 0x01, 0x18, 0x03], // special inquiry commands OP_IR_CONDITION: [0x09, 0x06, 0x34], OP_FAN_CONDITION: [0x09, 0x7e, 0x01, 0x38], OP_INFORMATION_DISPLAY_STATUS: [0x09, 0x7e, 0x01, 0x18], OP_VERSION_INQUIRY: [0x09, 0x00, 0x02], //mnq: model code //rstu: rom version //vw: socket number // block inquiries CAM_LENS_INQUIRY: [0x09, 0x7E, 0x7E, 0x00], // 0w 0w 0w 0w 0v 0v 0y 0y 0y 0y 00 WW VV // w: zoom position // v: focus near limit // y: focus position // WW: // bit 0 indicates autofocus status, // bit 1 indicates digital zoom status // bit 2 indicates AF sensitivity / 0-slow 1-normal // bits 3-4 indicate AF mode / 0-normal, 1-interval, 2-zoom trigger // VV: // bit 0 indicates zooming status / 0-stopped, 1-executing // bit 1 indicates focusing status // bit 2 indicates camera memory recall status / 0-stopped, 1-executing // bit 3 indicates low contrast detection CAM_IMAGE_INQUIRY: [0x09, 0x7E, 0x7E, 0x01], // 0w 0w 0v 0v 0a 0b 0c AA BB CC DD EE FF // w: R gain // v: B gain // a: WB mode // b: aperture gain // c: exposure mode // AA: // bit 0 slow shutter / 1-auto, 0-manual // bit 1 exposure comp // bit 2 backlight // bit 3 unused // bit 4 wide D / 0-off, 1-other // bit 5 High Res // BB: shutter position // CC: iris position // DD: gain position // EE: brightness // FF: exposure // == COMMAND ONLY CONSTANTS == // command constants (not available on inquiries) CMD_CAM_VAL_RESET: 0x00, CMD_CAM_VAL_CLEAR: 0x01, CMD_CAM_VAL_UP: 0x02, CMD_CAM_VAL_DOWN: 0x03, CMD_CAM_ZOOM_STOP: 0x00, CMD_CAM_ZOOM_TELE: 0x02, CMD_CAM_ZOOM_WIDE: 0x03, CMD_CAM_ZOOM_TELE_WITH_SPEED: 0x20, CMD_CAM_ZOOM_WIDE_WITH_SPEED: 0x30, CMD_CAM_FOCUS_STOP: 0x00, CMD_CAM_FOCUS_FAR: 0x02, CMD_CAM_FOCUS_NEAR: 0x03, CMD_CAM_FOCUS_FAR_WITH_SPEED: 0x20, CMD_CAM_FOCUS_NEAR_WITH_SPEED: 0x30, CMD_CAM_FOCUS_TRIGGER_NOW: 0x01, CMD_CAM_FOCUS_TRIGGER_INF: 0x02, CMD_CAM_WB_TRIGGER_NOW: 0x05, // == OTHER DATA CONSTANTS == // data constants DATA_RESET: 0x00, DATA_MORE: 0x02, DATA_LESS: 0x03, DATA_ONVAL: 0x02, DATA_OFFVAL: 0x03, DATA_TOGGLEVAL: 0x10, DATA_MEMORY_RESET: 0x00, DATA_MEMORY_SET: 0x01, DATA_MEMORY_RECALL: 0x02, DATA_IR_CORRECTION_ENABLED: 0x01, DATA_CAM_FOCUS_MODE_AUTO: 0x02, DATA_CAM_FOCUS_MODE_MANUAL: 0x03, DATA_CAM_FOCUS_MODE_TOGGLE: 0x10, DATA_CAM_AUTOFOCUS_ON_MOVEMENT: 0x00, DATA_CAM_AUTOFOCUS_ON_INTERVAL: 0x01, DATA_CAM_AUTOFOCUS_ON_ZOOM: 0x02, DATA_CAM_WB_MODE_AUTO: 0x00, DATA_CAM_WB_MODE_INDOOR: 0x01, DATA_CAM_WB_MODE_OUTDOOR: 0x02, DATA_CAM_WB_MODE_ON_TRIGGER: 0x03, DATA_CAM_WB_MODE_MANUAL: 0x04, DATA_CAM_EXPOSURE_MODE_AUTO: 0x00, DATA_CAM_EXPOSURE_MODE_MANUAL: 0x03, DATA_CAM_EXPOSURE_MODE_SHUTTER: 0x0a, DATA_CAM_EXPOSURE_MODE_IRIS: 0x0b, DATA_CAM_EXPOSURE_MODE_BRIGHT: 0x0d, DATA_CAM_WIDE_DYN_AUTO: 0x00, DATA_CAM_WIDE_DYN_RATIO: 0x01, DATA_CAM_WIDE_DYN_ON: 0x02, DATA_CAM_WIDE_DYN_OFF: 0x03, DATA_CAM_WIDE_DYN_HIST: 0x04, // basic effects DATA_EFFECT_OFF: 0x00, DATA_EFFECT_PASTEL: 0x01, DATA_EFFECT_NEGATIVE: 0x02, DATA_EFFECT_SEPIA: 0x03, DATA_EFFECT_BW: 0x04, DATA_EFFECT_SOLAR: 0x05, DATA_EFFECT_MOSAIC: 0x06, DATA_EFFECT_SLIM: 0x07, DATA_EFFECT_STRETCH: 0x08, // digital effects DATA_EFFECT_STILL: 0x01, DATA_EFFECT_FLASH: 0x02, DATA_EFFECT_LUMI: 0x03, DATA_EFFECT_TRAIL: 0x04, DATA_PANLEFT: 0x01, DATA_TILTUP: 0x01, DATA_PANRIGHT: 0x02, DATA_TILTDOWN: 0x02, DATA_PANSTOP: 0x00, DATA_TILTSTOP: 0x00, DATA_PANTILT_UR: 0x01, DATA_PANTILT_DL: 0x00, // pan status data masks PAN_MAXL: 0b0001, PAN_MAXR: 0b0010, PAN_MAXU: 0b0100, PAN_MAXD: 0b1000, PAN_PAN_UNK: 0b0001, PAN_TILT_UNK: 0b0001, PAN_MOVING: 0b0100, PAN_MOVE_DONE: 0b1000, PAN_MOVE_FAIL: 0b1100, PAN_NR: 0b0000, PAN_INIT: 0b0001, PAN_READY: 0b0010, PAN_INIT_FAIL: 0b0011, // error codes ERROR_SYNTAX: 0x02, ERROR_BUFFER_FULL: 0x03, ERROR_CANCELLED: 0x04, ERROR_INVALID_BUFFER: 0x05, ERROR_COMMAND_FAILED: 0x41, // Zoom and Focus Settings SONY_FOCUS_NEAR_LIMIT_SETTINGS: [ 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000, 0x8000, 0x9000, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000, ], SONY_OPTICAL_ZOOM_PRESETS: [ 0x0000, 0x16A1, 0x2063, 0x2628, 0x2A1D, 0x2D13, 0x2F6D, 0x3161, 0x330D, 0x3486, 0x35D7, 0x3709, 0x3820, 0x3920, 0x3A0A, 0x3ADD, 0x3B9C, 0x3C46, 0x3CDC, 0x3D60, 0x3DD4, 0x3E39, 0x3E90, 0x3EDC, 0x3F1E, 0x3F57, 0x3F8A, 0x3FB6, 0x3FDC, 0x4000, ], SONY_DIGITAL_ZOOM_PRESETS: [ 0x4000, 0x6000, 0x6A80, 0x7000, 0x7300, 0x7540, 0x76C0, 0x7800, 0x78C0, 0x7980, 0x7A00, 0x7AC0, ] }; exports.Constants = Constants; //# sourceMappingURL=constants.js.map