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