ホーム › Devices.Nfc › NFC_P2P_PARAM_CONFIG
NFC_P2P_PARAM_CONFIG
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| eP2pMode | NFC_P2P_MODE | 4 | +0 | +0 | P2P通信のモード(イニシエータ/ターゲット等)を示す列挙値。 |
| cbGeneralBytes | BYTE | 1 | +4 | +4 | pbGeneralBytesの一般バイト長を表す。 |
| pbGeneralBytes | BYTE | 48 | +5 | +5 | ATR交換等で用いる一般バイト(General Bytes)列。 |
各言語での定義
#include <windows.h>
// NFC_P2P_PARAM_CONFIG (x64 56 / x86 56 バイト)
typedef struct NFC_P2P_PARAM_CONFIG {
NFC_P2P_MODE eP2pMode;
BYTE cbGeneralBytes;
BYTE pbGeneralBytes[48];
} NFC_P2P_PARAM_CONFIG;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NFC_P2P_PARAM_CONFIG
{
public int eP2pMode;
public byte cbGeneralBytes;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] pbGeneralBytes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NFC_P2P_PARAM_CONFIG
Public eP2pMode As Integer
Public cbGeneralBytes As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=48)> Public pbGeneralBytes() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NFC_P2P_PARAM_CONFIG(ctypes.Structure):
_fields_ = [
("eP2pMode", ctypes.c_int),
("cbGeneralBytes", ctypes.c_ubyte),
("pbGeneralBytes", ctypes.c_ubyte * 48),
]#[repr(C)]
pub struct NFC_P2P_PARAM_CONFIG {
pub eP2pMode: i32,
pub cbGeneralBytes: u8,
pub pbGeneralBytes: [u8; 48],
}import "golang.org/x/sys/windows"
type NFC_P2P_PARAM_CONFIG struct {
eP2pMode int32
cbGeneralBytes byte
pbGeneralBytes [48]byte
}type
NFC_P2P_PARAM_CONFIG = record
eP2pMode: Integer;
cbGeneralBytes: Byte;
pbGeneralBytes: array[0..47] of Byte;
end;const NFC_P2P_PARAM_CONFIG = extern struct {
eP2pMode: i32,
cbGeneralBytes: u8,
pbGeneralBytes: [48]u8,
};type
NFC_P2P_PARAM_CONFIG {.bycopy.} = object
eP2pMode: int32
cbGeneralBytes: uint8
pbGeneralBytes: array[48, uint8]struct NFC_P2P_PARAM_CONFIG
{
int eP2pMode;
ubyte cbGeneralBytes;
ubyte[48] pbGeneralBytes;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NFC_P2P_PARAM_CONFIG サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; eP2pMode : NFC_P2P_MODE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cbGeneralBytes : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; pbGeneralBytes : BYTE (+5, 48byte) varptr(st)+5 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NFC_P2P_PARAM_CONFIG
#field int eP2pMode
#field byte cbGeneralBytes
#field byte pbGeneralBytes 48
#endstruct
stdim st, NFC_P2P_PARAM_CONFIG ; NSTRUCT 変数を確保
st->eP2pMode = 100
mes "eP2pMode=" + st->eP2pMode