unit LedAPI;

interface

Uses
  Windows,Messages;

Const
  LedSender = 'LedSender.dll';

Const
  INVALID_DEVICE_HANDLE = -1;

  DEVICE_TYPE_COM  =  0;
  DEVICE_TYPE_UDP  =  1;

  SBR_9600      =  0;
  SBR_14400     =  1;
  SBR_19200     =  2;
  SBR_38400     =  3;
  SBR_57600     =  4;
  SBR_115200    =  5;

  ROOT_PLAY     =  $11;      //下发节目为仅播放数据
  ROOT_DOWNLOAD =  $12;      //下发节目为保存并播放

  SCREEN_UNICOLOR  = 1;      //单色显示屏
  SCREEN_COLOR     = 1;      //双色显示屏
  SCREEN_FULLCOLOR = 3;      //全彩色显示屏
  SCREEN_GRAY      = 4;      //256级灰度屏

  LM_RX_COMPLETE   =  1;
  LM_TX_COMPLETE   =  2;
  LM_RESPOND       =  3;
  LM_TIMEOUT       =  4;
  LM_NOTIFY        =  5;
  LM_PARAM         =  6;
  LM_TX_PROGRESS   =  7;
  LM_RX_PROGRESS   =  8;

//时间格式定义，用于AddDateTime函数中format参数
  DF_YMD           = 1;      //年月日  "2004年12月31日"
  DF_HN            = 2;      //时分    "19:20"
  DF_HNS           = 3;      //时分秒  "19:20:30"
  DF_Y             = 4;      //年      "2004"
  DF_M             = 5;      //月      "12" "01" 注意：始终显示两位数字
  DF_D             = 6;      //日
  DF_H             = 7;      //时
  DF_N             = 8;      //分
  DF_S             = 9;      //秒
  DF_W             = 10;     //星期    "星期三"

//正计时、倒计时format参数
  CF_DAY           = 0;      //天数
  CF_HOUR          = 1;      //小时数
  CF_HMS           = 2;      //时分秒
  CF_HM            = 3;      //时分
  CF_MS            = 4;      //分秒
  CF_S             = 5;      //秒

  LED_POWER_ON     = 1;      //显示屏电源打开
  LED_POWER_OFF    = 0;      //显示屏电源已关闭

  FONT_SET_16      = 0;      //16点阵字符
  FONT_SET_24      = 1;      //24点阵字符
  
  PKC_QUERY           =  4;
  PKC_ADJUST_TIME     =  6;
  PKC_GET_POWER       =  9;
  PKC_SET_POWER       = 10;
  PKC_GET_BRIGHT      = 11;
  PKC_SET_BRIGHT      = 12;

Type
  TDeviceParam = Packed Record
    devType:   DWord;
    Speed:     DWord;
    ComPort:   DWord;
    FlowCon:   DWord;
    locPort:   DWord;
    rmtPort:   DWord;
    memory:    DWord;
    Reserved:  Array [0..4] of DWord;
  End;
  PDeviceParam = ^TDeviceParam;

  TNotifyMessage = Packed Record
    Message:  Integer;
    Command:  Integer;
    Result:   Integer;
    Status:   Integer;
    Address:  Integer;
    Size:     Integer;
    Buffer:   Pointer;
    Param:    TDeviceParam;
    Host:     Array [0..15] of Char;
    Port:     Integer;
  End;
  PNotifyMessage = ^TNotifyMessage;


  TTimeStamp = Packed Record
    date:      LongInt;
    time:      LongInt;
  End;
  PTimeStamp = ^TTimeStamp;

Procedure LED_Startup; Stdcall; External LedSender;
Procedure LED_Cleanup; StdCall; External LedSender;
Function  LED_Open(param: PDeviceParam; Notify, Window, Message: Integer): Integer; Stdcall; External LedSender;
Procedure LED_Close(dev: Integer); Stdcall; External LedSender;
Procedure LED_Query(dev: Integer; Address: Byte; Host: PChar; Port: Word); Stdcall; External LedSender;
Procedure LED_AdjustTime(dev: Integer; Address: Byte; Host: PChar; Port: Word); Stdcall; External LedSender;
Procedure LED_SendToScreen(dev: Integer; Address: Byte; Host: PChar; Port: Word); Stdcall; External LedSender;
Procedure LED_SetPower(dev: Integer; Address: Byte; Host: PChar; Port: Word; Power: DWord); Stdcall; External LedSender;
Procedure LED_GetPower(dev: Integer; Address: Byte; Host: PChar; Port: Word); Stdcall; External LedSender;
Procedure LED_SetBrightness(dev: Integer; Address: Byte; Host: PChar; Port: Word; Brightness: Byte); Stdcall; External LedSender;
Procedure LED_GetBrightness(dev: Integer; Address: Byte; Host: PChar; Port: Word); Stdcall; External LEDSender;
Function  MakeRoot(RootType: Integer; ScreenType: Integer): Integer; Stdcall; External LEDSender;
Function  AddLeaf(DisplayTime: Integer): Integer; Stdcall;  External LEDSender;
Function  AddWindow(DC: HDC; Width,Height: Integer; ARect: PRect; Method,Speed,Transparent: Integer): Integer; Stdcall;  External LEDSender;
Function  AddDateTime(ARect: PRect; Transparent: Integer; FontName: PChar; FontSize,FontColor: Integer; Format: Integer): Integer; Stdcall; External LEDSender;
Function  AddString(Str: PChar; ARect: PRect; Method,Speed,Transparent: Integer; FontSet,FontColor: Integer): Integer; Stdcall; External LEDSender;Function  AddText(str: PChar; rect: PRect; method: Integer; speed: Integer; transparent: Integer; fontname: PChar; fontsize,fontcolor: Integer): Integer; Stdcall; External LEDSender;
Function  AddMovie(filename: PChar; rect: PRect; stretch: Integer): Integer; Stdcall; External LEDSender;
Function  AddCountUp(rect: PRect; transparent: Integer; fontname: PChar; fontsize,fontcolor,format: Integer; starttime: PSystemTime): Integer; Stdcall; External LEDSender;
Function  AddCountDown(rect: PRect; transparent: Integer; fontname: PChar; fontsize,fontcolor,format: Integer; endtime: PSystemTime): Integer; Stdcall; External LEDSender;

implementation

end.

