armadsen/ORSSerialPort 2.1.0を使用しています。
ただし,シリアルポート付け外しの通知を受け取るため,CFRunLoopGetCurrentをCFRunLoopGetMainに書き換えてビルドしました。
標準コマンドのRECEIVE BUFFERは非Unicodeモードの遺物であり,BLOBに対応していません。
一方,RECEIVE PACKETはバックグランドで「待ち受け」することができません。
プラグインは,スリープの開始と解除・シリアルポートの取り外しと取り付けに反応し,バイナリデータを扱うことができます。
$ports:=SERIAL Get available ports
$usbserial:=$ports.query("path == :1"; "/dev/cu.usbserial@")
If ($usbserial.length#0)
$path:=$usbserial[0].path
$options:=New object
$status:=SERIAL Open path($path; $options; "serial_receive_method")
var $data : Blob
SET BLOB SIZE($data; 10)
$status:=SERIAL Send data($path; $data)
$status:=SERIAL Close path($path)
End if ports:=SERIAL Get available ports()| パラメーター | データ型 | 説明 |
|---|---|---|
| ports[] | Collection | シリアルポート |
| ports[] | Collection | |
| ports[].allowsNonStandardBaudRates | Boolean | |
| ports[].baudRate | Number | |
| ports[].CTS | Boolean | |
| ports[].DCD | Boolean | |
| ports[].DSR | Boolean | |
| ports[].DTR | Boolean | |
| ports[].isOpen | Boolean | |
| ports[].name | Text | |
| ports[].numberOfStopBits | Number | |
| ports[].parity | Text | none odd even |
| ports[].path | Text | |
| ports[].RTS | Boolean | |
| ports[].shouldEchoReceivedData | Boolean | |
| ports[].usesDCDOutputFlowControl | Boolean | |
| ports[].usesDTRDSRFlowControl | Boolean | |
| ports[].usesRTSCTSFlowControl | Boolean |
status:=SERIAL Open path(path{;options})| パラメーター | データ型 | 説明 |
|---|---|---|
| status | Object | |
| status.success | Boolean | |
| status.port | Object |
シリアル通信コールバック実行用のプロセス$SERIALが起動します。
シリアル通信を受信すると,下記のパラメーターでコールバックメソッドが実行されます。
#DECLARE($path : Text; $data : Blob)status:=SERIAL Close path(path)| パラメーター | データ型 | 説明 |
|---|---|---|
| status | Object | |
| status.success | Boolean |
status:=SERIAL Send data(path)| パラメーター | データ型 | 説明 |
|---|---|---|
| status | Object | |
| status.success | Boolean |
| USB⇄RS-232Cコンバーター | チップ | VCM Driver | macOS | 4D | 対応 |
|---|---|---|---|---|---|
| REX-USB60F | FTDI | 2.4.4 | Catalina | 19 | OK |
| 2.4.4 | Monterey arm64 | 19 | × | ||
| 2.4.4 | Monterey rosetta | 19 | × | ||
| 1.4.7 | Monterey arm64 | 19 | × | ||
| 1.4.7 | Monterey rosetta | 19 | × |