Skip to content

Instantly share code, notes, and snippets.

@xerp
Created May 8, 2015 14:49
Show Gist options
  • Save xerp/74ad3748cff86b2ccd40 to your computer and use it in GitHub Desktop.
Save xerp/74ad3748cff86b2ccd40 to your computer and use it in GitHub Desktop.
RS-232 Connection DELL 4220 Projector
import serial
BAUDRATE=19200
class Projector:
def __init__(self,port_name,timeout=1):
self.__serial = serial.Serial()
self.__serial.port = port_name
self.__serial.timeout = timeout
self.__serial.baudrate= BAUDRATE
def is_open_connection(self):
return self.__serial.isOpen()
def open_connection(self):
self.__serial.open()
def close_connection(self):
self.__serial.close();
def send_command(command = Commands.NONE):
self.__serial.write(command)
class Commands:
NONE = []
POWER_ON = [0xBE,0xEF,0x10,0x05,0x00,0xC6,0xFF,0x11,0x11,0x01,0x00,0x01]
POWER_OFF = [0xBE,0xEF,0x10,0x05,0x00,0x0C,0x3E,0x11,0x11,0x01,0x00,0x18]
HIDE_ON = [0xBE,0xEF,0x10,0x05,0x00,0x02,0x7E,0x11,0x11,0x01,0x00,0x0F]
HIDE_OFF = [0xBE,0xEF,0x10,0x05,0x00,0xED,0x3F,0x11,0x11,0x01,0x00,0x64]
FREEZE_ON = [0xBE,0xEF,0x10,0x05,0x00,0xC2,0xBF,0x11,0x11,0x01,0x00,0x0E]
FREEZE_OFF = [0xBE,0xEF,0x10,0x05,0x00,0xEF,0xBF,0x11,0x11,0x01,0x00,0x62]
VGA_ANALOG_A = [0xBE,0xEF,0x10,0x05,0x00,0xCC,0xFF,0x11,0x11,0x01,0x00,0x19]
VGA_ANALOG_B = [0xBE,0xEF,0x10,0x05,0x00,0x28,0xFE,0x11,0x11,0x01,0x00,0x69]
PROJECTOR_FRONT = [0xBE,0xEF,0x10,0x06,0x00,0x9A,0xE3,0x11,0x11,0x00,0x00,0x33,0x01]
PROJECTOR_FRONT_CEILING = [0xBE,0xEF,0x10,0x06,0x00,0x9A,0xE3,0x11,0x11,0x00,0x00,0x33,0x02]
PROJECTOR_REAR = [0xBE,0xEF,0x10,0x06,0x00,0x9A,0xE3,0x11,0x11,0x00,0x00,0x33,0x03]
PROJECTOR_REAR_CEILING = [0xBE,0xEF,0x10,0x06,0x00,0x9A,0xE3,0x11,0x11,0x00,0x00,0x33,0x04]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment