亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? adpacket.pas

?? Async Professional 4.04
?? PAS
?? 第 1 頁 / 共 3 頁
字號:
{*********************************************************}
{*                   ADPACKET.PAS 4.04                   *}
{*      Copyright (C) TurboPower Software 1997-2002      *}
{*                 All rights reserved.                  *}
{*********************************************************}

{Global defines potentially affecting this unit}
{$I AWDEFINE.INC}

unit AdPacket;

interface

uses
  WinTypes,
  WinProcs,
  Messages,
  SysUtils,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  OoMisc,
  AdExcept,
  AdPort,
  AwUser;

type
  TPacketStartCond = (scString,scAnyData);
  TPacketEndCond = (ecString,ecPacketSize);
  TPacketEndSet = set of TPacketEndCond;

const
  EscapeCharacter = '\';   { Use \\ to specify an actual '\' in the match strings}
  WildCardCharacter = '?'; { Use \? to specify an actual '?' in the match strings} 
  adpDefEnabled = True;
  adpDefIgnoreCase = True;
  adpDefIncludeStrings = True;
  adpDefAutoEnable = True;
  adpDefStartCond = scString;
  adpDefTimeOut = 2184;
  apdDefFlushOnTimeout = True;                                           {!!.04}

type
  TApdDataPacket = class;
  TApdDataPacketManager = class;
  TApdDataPacketManagerList = class
    {Maintains a list of packet managers so that a packet can
     locate the current packet manager for its comport.
     If no packet manager currently exists for the port, the
     packet will create one. When the last packet dis-connects
     itself from the packet manager, the packet manager self-
     destructs.}
  private
    ManagerList : TList;
  public
    constructor Create;
    destructor Destroy; override;
    procedure Insert(Value : TApdDataPacketManager);
    procedure Remove(Value : TApdDataPacketManager);
    function GetPortManager(ComPort : TApdCustomComPort) : TApdDataPacketManager;
  end;

  TApdDataPacketManager = class
    {Packet manager. One instance of these exists per com port using
     packets. The packet manager does the actual data buffering for
     all packets attached to its port.}
  private
    PacketList : TList;
    fComPort : TApdCustomComPort;
    HandlerInstalled : Boolean;
    fEnabled : Boolean;
    BufferPtr : Integer;
    fDataBuffer : pChar;
    dpDataBufferSize : Integer;
    fCapture : TApdDataPacket;
    Timer : Integer;
    fInEvent : Boolean;
    NotifyPending : Boolean;
    NotifyStart : Integer;
    EnablePending : Boolean;
    FKeepAlive : Boolean;

    FWindowHandle : HWND;
  protected
    procedure WndProc(var Msg: TMessage);
    procedure DisposeBuffer;
     {- Get rid of any pending data and release any buffer space}
    procedure NotifyData(NewDataStart : Integer);
     {- Notify the attached packet(s) that new data is available}
    procedure EnablePackets;
     {- Initialize all enabled packets for data capture}
    procedure DisablePackets;
     {- Shut off data capture for all attached packets}
    procedure PacketTriggerHandler(Msg, wParam : Cardinal;
                                 lParam : Longint);
     {- process messages from dispatcher}
    procedure PortOpenClose(CP : TObject; Opening : Boolean);
     {- Event handler for the port open/close event}
    procedure PortOpenCloseEx(CP: TObject; CallbackType: TApdCallbackType);{!!.03}
     {- Extended event handler for the port open/close event}

    procedure SetInEvent(Value : Boolean);
     {- Property write method for the InEvent property}
    procedure SetEnabled(Value : Boolean);
     {- Proporty write method for the Enabled property}
  public
    constructor Create(ComPort : TApdCustomComPort);
    destructor Destroy; override;
    procedure Enable;
     {- Install com port event handlers}
    procedure EnableIfPending;
     {- Enable after form load}
    procedure Disable;
     {- Remove com port event handlers}
    procedure Insert(Value : TApdDataPacket);
     {- Add a packet to the list}
    procedure Remove(Value : TApdDataPacket);
     {- Remove a packet to the list}
    procedure RemoveData(Start,Size : Integer);
     {- Remove packet data from the data buffer}
    procedure SetCapture(Value : TApdDataPacket; TimeOut : Integer);
     {- Set ownership of incoming data to a particular packet}
    procedure ReleaseCapture(Value : TApdDataPacket);
     {- Opposite of SetCapture, see above}
    property DataBuffer : pChar read fDataBuffer;
     {- The packet data buffer for the port. Only packets should access this}
    property ComPort : TApdCustomComPort read fComPort;
     {- The com port associated with this packet manager}
    property Enabled : Boolean read fEnabled write SetEnabled;
     {- Controls whether the packet manager is active
        set/reset when the com port is opened or closed}
    property InEvent : Boolean read fInEvent write SetInEvent;
     {- Event flag set by packets to prevent recursion issues}
    property KeepAlive : Boolean read FKeepAlive write FKeepAlive;
  end;

  TPacketMode = (dpIdle,dpWaitStart,dpCollecting);
  TPacketNotifyEvent = procedure(Sender: TObject; Data : Pointer; Size : Integer) of object;
  TStringPacketNotifyEvent = procedure(Sender: TObject; Data : string) of object;
  TApdDataPacket = class(TApdBaseComponent)
  private
    fManager : TApdDataPacketManager;
    fStartCond : TPacketStartCond;
    fEndCond : TPacketEndSet;
    fStartString,fEndString : string;
    fComPort : TApdCustomComPort;
    fMode : TPacketMode;
    fPacketSize : Integer;
    fOnPacket : TPacketNotifyEvent;
    fOnStringPacket : TStringPacketNotifyEvent;
    fOnTimeOut : TNotifyEvent;
    fTimeOut : Integer;
    fDataSize : Integer;
    fBeginMatch : Integer;
    fAutoEnable : Boolean;
    fIgnoreCase : Boolean;
    fEnabled : Boolean;
    fIncludeStrings : Boolean;

    PacketBuffer : pChar;
    StartMatchPos,EndMatchPos,EndMatchStart : Integer;
    LocalPacketSize : Integer;
    WildStartString,
    WildEndString,
    InternalStartString,
    InternalEndString : string;
    WillCollect : Boolean;
    EnablePending : Boolean;
    HaveCapture : Boolean;
    FSyncEvents : Boolean;
    FDataMatch,
    FTimedOut : Boolean;
    FEnableTimeout: Integer;                                             {!!.04}
    FEnableTimer : Integer;                                              {!!.04}
    FFlushOnTimeout : Boolean;                                           {!!.04}
  protected
    procedure SetComPort(const NewComPort : TApdCustomComPort);
    procedure Notification(AComponent : TComponent; Operation : TOperation); override;
    procedure SetEnabled(Value : Boolean);
    procedure SetMode(Value : TPacketMode);
    procedure SetEndCond(const Value: TPacketEndSet);
    procedure SetEndString(Value : String);
    procedure SetFlushOnTimeout (const v : Boolean);                     {!!.04}
    procedure ProcessData(StartPtr : Integer);
     {- Processes incoming data, collecting and/or looking for a match}
    procedure Packet(Reason : TPacketEndCond);
     {- Set up parameters and call DoPacket to generate an event}
    procedure TimedOut;
     {- Set up parameters and call DoTimeout to generate an event}
    procedure DoTimeout;
     {- Generate an OnTimeOut event}
    procedure DoPacket;
     {- Generate an OnPacket event}
    procedure NotifyRemove(Data : Integer);
     {- Called by the packet manager to cancel any partial matches}
    procedure Resync;
     {- Look for a match starting beyond the first character.
        Called when a partial match fails, or when data has
        been removed by another packet.}
    procedure CancelMatch;
     {- Cancel any pending partial match. Called by the packet manager
        when another packet takes capture.}
    procedure Loaded; override;
    procedure LogPacketEvent(Event : TDispatchSubType;
      Data : Pointer; DataSize : Integer);
     {- add packet specific events to log file, if logging is requested}

    property BeginMatch : Integer read fBeginMatch;
     {- Beginning of the current match. -1 if no match yet}
    property Manager : TApdDataPacketManager read fManager write fManager;
     {- The packet manager controlling this packet}
    property Mode : TPacketMode read fMode write SetMode;
     {- Current mode. Can be either Idle = not currently enabled,
        WaitStart = trying to match the start string, or
        Collecting = start condition has been met; collecting data}

    procedure Enable;
     {- Enable the packet}
    procedure Disable;
     {- Disable the packet}

    procedure TriggerHandler(Msg, wParam : Cardinal; lParam : Longint);  {!!.04}
     {- process messages from dispatcher, only used for the EnableTimeout}
  public
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
    procedure GetCollectedString(var Data : String);
     {- Returns data collected in OnStringPacket format}
    procedure GetCollectedData(var Data : Pointer; var Size : Integer);
     {- Returns data collected in OnPacket format}
    property InternalManager : TApdDataPacketManager read FManager;
      { - Internal use only!  Do not touch }
    property EnableTimeout : Integer                                     {!!.04}
      read FEnableTimeout write FEnableTimeout default 0;                {!!.04}
      {- A timeout that starts when the packet is enabled }
    property FlushOnTimeout : Boolean                                    {!!.04}
      read FFlushOnTimeout Write SetFlushOnTimeout default True;         {!!.04}
      {- Determines whether the packet buffer is flushed on timeout }

    property SyncEvents : Boolean read FSyncEvents write FSyncEvents;
     {- Controls whether packet events are synchronized to the main VCL thread.
        Default is True.}
    property PacketMode : TPacketMode read fMode;
     {- Read-only property to show if we are idle, waiting, or collecting }
    function WaitForString(var Data : string) : Boolean;                 {!!.01}
     {- Waits for the data match condition or a timeout, return the collected string }
    function WaitForPacket(var Data : Pointer; var Size : Integer) : Boolean;{!!.01}
     {- Waits for the data match condition or a timeout, return the collected string }
  published
    property Enabled : Boolean read fEnabled write SetEnabled nodefault;
     {- Is the packet enabled.}
    property AutoEnable : Boolean read fAutoEnable write fAutoEnable default adpDefAutoEnable;
     {- Fire only first time, or fire whenever the conditions are met.}
    property StartCond : TPacketStartCond read fStartCond write fStartCond default adpDefStartCond;
     {- Conditions for this packet to start collecting data}
    property EndCond : TPacketEndSet read fEndCond write SetEndCond default [];
     {- Conditions for this packet to stop collecting data}
    property StartString : string read fStartString write fStartString;
     {- Packet start string}
    property EndString : string read fEndString write SetEndString;
     {- Packet end string}
    property IgnoreCase : Boolean read fIgnoreCase write fIgnoreCase default adpDefIgnoreCase;
     {- Ignore case when matching StartString and EndString}
    property ComPort : TApdCustomComPort read FComPort write SetComPort;
     {- The com port for which data is being read}
    property PacketSize : Integer read fPacketSize write fPacketSize;
     {- Size of a packet with packet size as part of the end conditions}
    property IncludeStrings : Boolean read fIncludeStrings write fIncludeStrings default adpDefIncludeStrings;
     {- Controls whether any start and end strings should be included in the
        data buffer passed to the event handler}
    property TimeOut : Integer read fTimeOut write fTimeOut default adpDefTimeOut;
     {- Number of ticks that can pass from when the packet goes into data
        collection mode until the packet is complete. 0 = no timeout}
    property OnPacket : TPacketNotifyEvent read fOnPacket write fOnPacket;
     {- Event fired when a complete packet is received}
    property OnStringPacket : TStringPacketNotifyEvent read fOnStringPacket write fOnStringPacket;
     {- Event fired when a complete packet is received}
    property OnTimeout : TNotifyEvent read fOnTimeout write fOnTimeout;
     {- Event fired when a packet times out}
  end;

implementation

{$IFDEF TRIALRUN}
  {$I TRIAL07.INC}
  {$I TRIAL03.INC}
  {$I TRIAL01.INC}
{$ENDIF}

var
  PacketManagerList : TApdDataPacketManagerList;

constructor TApdDataPacketManagerList.Create;
begin
  inherited Create;
  ManagerList := TList.Create;
end;

destructor TApdDataPacketManagerList.Destroy;
begin
  ManagerList.Free;
  inherited Destroy;
end;

procedure TApdDataPacketManagerList.Insert(Value : TApdDataPacketManager);
begin
  ManagerList.Add(Value);
end;

procedure TApdDataPacketManagerList.Remove(Value : TApdDataPacketManager);
begin
  ManagerList.Remove(Value);
end;

function TApdDataPacketManagerList.GetPortManager(ComPort : TApdCustomComPort) : TApdDataPacketManager;
var
  i : integer;
begin
  Result := nil;
  for i := 0 to pred(ManagerList.Count) do
    if TApdDataPacketManager(ManagerList[i]).ComPort = ComPort then begin
      Result := TApdDataPacketManager(ManagerList[i]);
      exit;
    end;
end;

constructor TApdDataPacketManager.Create(ComPort : TApdCustomComPort);
{$IFDEF TRIALRUN}
  {$I TRIAL04.INC}
{$ENDIF}
begin
{$IFDEF TRIALRUN}
  TC;
{$ENDIF}
  inherited Create;
  fComPort := ComPort;
  {fComPort.RegisterUserCallback(PortOpenClose);}                        {!!.03}
  FComPort.RegisterUserCallbackEx(PortOpenCloseEx);                      {!!.03}
  PacketList := TList.Create;
  FKeepAlive := False;
  PacketManagerList.Insert(Self);
  Enabled := fComPort.Open
    and ([csDesigning, csLoading] * fComPort.ComponentState = []);
  EnablePending :=
    not (csDesigning in fComPort.ComponentState) and
    not Enabled and fComPort.Open;
  FWindowHandle := AllocateHWnd(WndProc);                                {!!.02}
end;

destructor TApdDataPacketManager.Destroy;
begin
  FKeepAlive := True;
  PacketManagerList.Remove(Self);
  Enabled := False;
  {fComPort.DeregisterUserCallback(PortOpenClose);}                      {!!.03}
  FComPort.DeregisterUserCallbackEx(PortOpenCloseEx);                    {!!.03}
  DisposeBuffer;
  PacketList.Free;
  DeallocateHWnd(FWindowHandle);
  inherited Destroy;
end;

procedure TApdDataPacketManager.EnableIfPending;
begin
  if EnablePending then begin
    Enabled := True;
    EnablePending := False;
  end;
end;

procedure TApdDataPacketManager.Insert(Value : TApdDataPacket);
begin
  PacketList.Add(Value);
  Value.Manager := Self;
end;

procedure TApdDataPacketManager.Remove(Value : TApdDataPacket);
begin
  PacketList.Remove(Value);
  if fInEvent then exit;
  Value.Manager := nil;
  if (PacketList.Count = 0) and (not FKeepAlive) then begin
    {FWindowHandle := AllocateHWnd(WndProc);}                            {!!.02}
    PostMessage(FWindowHandle, CM_RELEASE, 0, 0);
  end;
end;

procedure TApdDataPacketManager.RemoveData(Start,Size : Integer);
var
  NewStart,i : Integer;
begin
  NewStart := Start+Size;
  dec(BufferPtr,NewStart);
  if BufferPtr > 0 then begin
    move(fDataBuffer[NewStart],fDataBuffer[0],BufferPtr);
  end else
    DisposeBuffer;
  for i := 0 to pred(PacketList.Count) do
    TApdDataPacket(PacketList[i]).NotifyRemove(NewStart);
end;

procedure TApdDataPacketManager.SetCapture(Value : TApdDataPacket; TimeOut : Integer);
var
  i : integer;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国v精品久久久网| 亚洲电影一区二区三区| 国产精品亚洲一区二区三区在线| 精品一区二区三区香蕉蜜桃| 91.xcao| 午夜精品在线视频一区| 欧美日韩1234| 午夜精品123| 久久综合狠狠综合久久综合88 | 亚洲免费视频成人| 国产.欧美.日韩| 国产精品久久久久影院老司 | 国产精品理论在线观看| 高清久久久久久| 中文字幕一区日韩精品欧美| 91网上在线视频| 亚洲午夜电影网| 7777精品久久久大香线蕉| 热久久一区二区| 欧美专区亚洲专区| 亚洲激情图片一区| 欧美伊人精品成人久久综合97| 一区二区视频免费在线观看| 欧美中文字幕亚洲一区二区va在线| 一区二区视频免费在线观看| 欧美中文字幕亚洲一区二区va在线| 亚洲国产精品久久久久婷婷884| 欧美亚男人的天堂| 麻豆一区二区99久久久久| 精品91自产拍在线观看一区| 国产成人在线影院| 国产精品萝li| 91黄视频在线观看| 日韩精品亚洲一区二区三区免费| 精品女同一区二区| 91网站在线观看视频| 亚洲mv在线观看| 久久久午夜精品理论片中文字幕| 不卡影院免费观看| 天天综合日日夜夜精品| 久久久国产午夜精品| 色噜噜狠狠成人中文综合| 天天爽夜夜爽夜夜爽精品视频| 欧美三级蜜桃2在线观看| 狠狠色丁香九九婷婷综合五月| 国产精品欧美精品| 6080亚洲精品一区二区| 国产乱码字幕精品高清av| 日本一区二区成人| 欧美日韩国产电影| 国产成人免费av在线| 亚洲一区视频在线观看视频| 欧美一级日韩不卡播放免费| 91免费视频大全| 精品一区二区三区在线视频| 日本一区二区三区久久久久久久久不 | 欧洲视频一区二区| 美女网站在线免费欧美精品| 最新国产成人在线观看| 日韩美女在线视频 | 91在线视频官网| 精品一区二区三区av| 一二三区精品视频| 欧美三级电影在线看| 国产亚洲婷婷免费| 成人av综合在线| 久热成人在线视频| 视频一区二区三区在线| 中文字幕中文字幕在线一区| 亚洲精品成人在线| 国产亚洲精品中文字幕| 欧美一区二区三区免费观看视频| 国产电影一区在线| 老司机午夜精品| 午夜精品久久久久久久| 久久精品视频在线免费观看| 欧美亚日韩国产aⅴ精品中极品| 成人黄色国产精品网站大全在线免费观看 | 亚洲欧洲三级电影| 国产亚洲精品aa午夜观看| 91精品国产色综合久久不卡蜜臀| 色素色在线综合| 成人短视频下载| 丁香一区二区三区| 美女视频黄a大片欧美| 亚洲成人先锋电影| 亚洲香肠在线观看| 一区二区三区在线免费视频| 亚洲专区一二三| 日韩电影在线看| 美女视频网站久久| 懂色中文一区二区在线播放| 成人av影院在线| 91精彩视频在线| 日韩视频免费直播| 久久久久久亚洲综合| 自拍偷拍亚洲综合| 亚洲国产精品视频| 黑人精品欧美一区二区蜜桃| 成人sese在线| 欧美人成免费网站| 国产色一区二区| 亚洲同性gay激情无套| 亚洲va天堂va国产va久| 黄网站免费久久| 91麻豆swag| 日韩一二三区不卡| 国产精品天美传媒| 亚洲国产一区在线观看| 国产美女精品人人做人人爽| 色综合久久中文字幕综合网| 91精品国产欧美一区二区18| 欧美激情一区二区在线| 亚洲一区二区五区| 国产精品一区久久久久| 欧洲精品一区二区| 久久综合九色综合97_久久久| 亚洲欧美另类久久久精品| 精一区二区三区| 在线免费观看成人短视频| 欧美成人精品1314www| 1024国产精品| 狠狠久久亚洲欧美| 日韩精品影音先锋| 亚洲黄色av一区| 国产精品1区2区| 欧美美女直播网站| 最新日韩在线视频| 韩国女主播一区二区三区| 欧美在线不卡一区| 国产精品青草久久| 韩国av一区二区| 宅男在线国产精品| 亚洲视频一二区| 顶级嫩模精品视频在线看| 日韩午夜精品电影| 亚洲国产中文字幕| 色又黄又爽网站www久久| 久久久亚洲综合| 美女尤物国产一区| 欧美美女一区二区三区| 亚洲蜜臀av乱码久久精品| 成人免费毛片片v| 精品99999| 久热成人在线视频| 在线不卡的av| 天堂久久一区二区三区| 在线亚洲+欧美+日本专区| 国产精品丝袜91| 国产成人免费视| 国产亚洲综合色| 精品亚洲aⅴ乱码一区二区三区| 在线不卡免费av| 午夜电影网亚洲视频| 欧美婷婷六月丁香综合色| 亚洲精品大片www| 一本色道久久综合狠狠躁的推荐 | 国产精品天天看| 国产精品一区二区三区99| 欧美日韩三级一区二区| 亚洲精品成人精品456| 91一区二区在线| 亚洲欧洲精品一区二区三区| 风间由美性色一区二区三区| 久久久久国产免费免费 | 亚洲一区在线免费观看| 色婷婷综合久久| 亚洲精品第一国产综合野| 99精品久久99久久久久| 亚洲日穴在线视频| 色婷婷亚洲精品| 亚洲va欧美va国产va天堂影院| 欧美日韩一级片网站| 午夜久久久久久久久久一区二区| 欧美精品粉嫩高潮一区二区| 久久精品国产99久久6| 久久久夜色精品亚洲| 不卡一区在线观看| 一区二区三区在线播| 欧美年轻男男videosbes| 免费在线观看视频一区| 51午夜精品国产| 国产性天天综合网| 欧美一区二区三区四区久久| 久久久精品综合| 亚洲欧美日韩国产中文在线| 91在线视频观看| 亚洲一区二区三区爽爽爽爽爽| 欧美麻豆精品久久久久久| 麻豆一区二区三区| 中文一区在线播放| 色94色欧美sute亚洲线路一久 | 一本色道综合亚洲| 午夜欧美在线一二页| 26uuu精品一区二区在线观看| 成人app在线观看| 亚洲国产乱码最新视频 | 99精品视频一区| 视频在线观看一区| 国产亚洲一区二区三区在线观看|