Latest 1.3
Homepage https://github.com/Kyome22/SerialGate
License MIT
Platforms osx 10.10, requires ARC
Frameworks Appkit, IOKit
Authors

Serial Communication Library for macOS written by Swift.

Installation

1.For installation with CocoaPods, simply add the following to your Podfile:

pod 'SerialGate'

2.Put a check mark for "USB" in Capabilities of Targets (SandBox)

sandbox

3.Edit the entitlements and add com.apple.security.device.serial

entitlements

Demo

Serial Communication Demo App for Arduino or mbed is in this Project.
entitlements

Usage

  • Get serial ports
let manager = SGPortManager.shared
let serialPorts = manager.availablePorts
  • Open a serial port
port.delegate = self      // SGPortDelegate is required
port.baudRate = B9600
port.open()
  • Close a serial port
port.close()
  • Send a message
let text: String = "Hello World"
port.send(text)
  • Read messages

⚠️ SerialGate waits until gets a new line code ("n" or "rn") and does not return values.

func received(_ texts: [String]) { }   // SGPortDelegate is required
  • Get notification of updated of availablePorts.
func updatedAvailablePorts() { }    // SGPortManagerDelegate is required

Latest podspec

{
    "name": "SerialGate",
    "version": "1.3",
    "summary": "Serial Communication Library for macOS written by Swift.",
    "description": "By using SerialGate, serial communication with Arduino and mbed can be implemented easily.nSerial communication demo app can be downloaded from GitHub.",
    "homepage": "https://github.com/Kyome22/SerialGate",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Takuto Nakamura": "[email protected]"
    },
    "social_media_url": "https://twitter.com/Kyomesuke3",
    "platforms": {
        "osx": "10.10"
    },
    "source": {
        "git": "https://github.com/Kyome22/SerialGate.git",
        "tag": "1.3"
    },
    "frameworks": [
        "Appkit",
        "IOKit"
    ],
    "source_files": "SerialGate/**/*.swift",
    "swift_version": "4.2",
    "requires_arc": true
}

Pin It on Pinterest

Share This