ホーム › Devices.SerialCommunication › SERIAL_HANDFLOW
SERIAL_HANDFLOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ControlHandShake | DWORD | 4 | +0 | +0 | RTS/DTR等のハードウェアフロー制御を構成するフラグ。 |
| FlowReplace | DWORD | 4 | +4 | +4 | XON/XOFF等のソフトウェアフロー制御を構成するフラグ。 |
| XonLimit | INT | 4 | +8 | +8 | XONを送出する受信バッファ残量のしきい値をバイトで表す。 |
| XoffLimit | INT | 4 | +12 | +12 | XOFFを送出する受信バッファ使用量のしきい値をバイトで表す。 |
各言語での定義
#include <windows.h>
// SERIAL_HANDFLOW (x64 16 / x86 16 バイト)
typedef struct SERIAL_HANDFLOW {
DWORD ControlHandShake;
DWORD FlowReplace;
INT XonLimit;
INT XoffLimit;
} SERIAL_HANDFLOW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SERIAL_HANDFLOW
{
public uint ControlHandShake;
public uint FlowReplace;
public int XonLimit;
public int XoffLimit;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SERIAL_HANDFLOW
Public ControlHandShake As UInteger
Public FlowReplace As UInteger
Public XonLimit As Integer
Public XoffLimit As Integer
End Structureimport ctypes
from ctypes import wintypes
class SERIAL_HANDFLOW(ctypes.Structure):
_fields_ = [
("ControlHandShake", wintypes.DWORD),
("FlowReplace", wintypes.DWORD),
("XonLimit", ctypes.c_int),
("XoffLimit", ctypes.c_int),
]#[repr(C)]
pub struct SERIAL_HANDFLOW {
pub ControlHandShake: u32,
pub FlowReplace: u32,
pub XonLimit: i32,
pub XoffLimit: i32,
}import "golang.org/x/sys/windows"
type SERIAL_HANDFLOW struct {
ControlHandShake uint32
FlowReplace uint32
XonLimit int32
XoffLimit int32
}type
SERIAL_HANDFLOW = record
ControlHandShake: DWORD;
FlowReplace: DWORD;
XonLimit: Integer;
XoffLimit: Integer;
end;const SERIAL_HANDFLOW = extern struct {
ControlHandShake: u32,
FlowReplace: u32,
XonLimit: i32,
XoffLimit: i32,
};type
SERIAL_HANDFLOW {.bycopy.} = object
ControlHandShake: uint32
FlowReplace: uint32
XonLimit: int32
XoffLimit: int32struct SERIAL_HANDFLOW
{
uint ControlHandShake;
uint FlowReplace;
int XonLimit;
int XoffLimit;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SERIAL_HANDFLOW サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; ControlHandShake : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; FlowReplace : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; XonLimit : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; XoffLimit : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SERIAL_HANDFLOW
#field int ControlHandShake
#field int FlowReplace
#field int XonLimit
#field int XoffLimit
#endstruct
stdim st, SERIAL_HANDFLOW ; NSTRUCT 変数を確保
st->ControlHandShake = 100
mes "ControlHandShake=" + st->ControlHandShake