Skip to content

Commit

Permalink
Version 4.1.0 and Version 4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
daizhirui committed Jul 11, 2019
1 parent 2f0a54a commit b8ddf20
Show file tree
Hide file tree
Showing 771 changed files with 630 additions and 907 deletions.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Cocoa
import ORSSerial
import CSXLog

public class CSXSerialManager: NSObject {

Expand Down Expand Up @@ -87,29 +88,29 @@ extension CSXSerialManager {

extension CSXSerialManager: CSXSerialBufferDelegate {
func didOpenSerialPort(_ buffer: CSXSerialBuffer) {
print("Port \(buffer.serialPort.name) opened")
CSXLog.printLog("\(CSXSerialManager.self): Port \(buffer.serialPort.name) opened")
NotificationCenter.default.post(name: CSXSerialManager.didOpenSerialPortNotification,
object: self,
userInfo: [CSXSerialManager.Key.Port : buffer.serialPort])
}

func didCloseSerialPort(_ buffer: CSXSerialBuffer) {
print("Port \(buffer.serialPort.name) closed")
CSXLog.printLog("\(CSXSerialManager.self): Port \(buffer.serialPort.name) closed")
NotificationCenter.default.post(name: CSXSerialManager.didCloseSerialPortNotification,
object: self,
userInfo: [CSXSerialManager.Key.Port : buffer.serialPort])
}

func csxSerialBuffer(_ buffer: CSXSerialBuffer, didReceive request: SerialRequest) {
print("Receive: \(request.response)")
CSXLog.printLog("\(CSXSerialManager.self): Receive: \(request.response)")
NotificationCenter.default.post(name: CSXSerialManager.didReceiveRequestNotification,
object: self,
userInfo: [CSXSerialManager.Key.Port : buffer.serialPort,
CSXSerialManager.Key.Request : request])
}

func csxSerialBuffer(_ buffer: CSXSerialBuffer, isTimeout request: SerialRequest) {
print("Timeout: \(request.response)")
CSXLog.printLog("\(CSXSerialManager.self): Timeout: \(request.response)")
NotificationCenter.default.post(name: CSXSerialManager.requestIsTimeoutNotification,
object: self,
userInfo: [CSXSerialManager.Key.Port : buffer.serialPort,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -53,6 +53,10 @@
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="Ah7-Fn-3On"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="yfR-Rv-N74">
<rect key="frame" x="-100" y="-100" width="100" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="gd4-Cv-cYG">
<rect key="frame" x="342" y="0.0" width="16" height="341"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -256,6 +260,10 @@
<constraints>
<constraint firstAttribute="height" constant="60" id="3cU-49-wiJ"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="7I7-eD-Gar">
<rect key="frame" x="-100" y="-100" width="318" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Ph0-K5-PWb">
<rect key="frame" x="302" y="0.0" width="16" height="60"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public class SerialMonitorViewController: NSViewController {
self.outputView.userInputDelegate = self
self.uploader.delegate = self

NotificationCenter.default.addObserver(self, selector: #selector(self.serialPortOpenedOrClosed(_:)),
name: CSXSerialManager.didOpenSerialPortNotification,
object: self.serialManager)

NotificationCenter.default.addObserver(self, selector: #selector(self.serialPortOpenedOrClosed(_:)),
name: CSXSerialManager.didCloseSerialPortNotification,
object: self.serialManager)

NotificationCenter.default.addObserver(self, selector: #selector(self.serialPortEmergencyReaction(_:)),
name: CSXSerialManager.didDisconnectSerialPortNotification,
object: self.serialManager)
Expand Down Expand Up @@ -84,6 +92,18 @@ public class SerialMonitorViewController: NSViewController {
func updateBaudrateLabel() {
if let port = self.selectedPort {
self.baudrateLabel.stringValue = "Baudrate: \(port.baudRate) bps"
} else {
self.baudrateLabel.stringValue = ""
}
}

@objc func serialPortOpenedOrClosed(_ notification: Notification) {
guard let userInfo = notification.userInfo else { return }
guard let port = userInfo[CSXSerialManager.Key.Port] as? ORSSerialPort else { return }
if port.isOpen {
self.openPortButton.title = "Close"
} else {
self.openPortButton.title = "Open"
}
}

Expand All @@ -92,7 +112,6 @@ public class SerialMonitorViewController: NSViewController {

guard let portName = userInfo[CSXSerialManager.Key.PortName] as? String else { return }
if self.selectedPort?.name == portName {
self.openPortButton.title = "Open"
self.portPopupButton.select(nil) // deselect all the ports
}
}
Expand All @@ -101,11 +120,9 @@ public class SerialMonitorViewController: NSViewController {
guard let port = self.selectedPort else { return }
if port.isOpen {
port.close()
sender.title = "Open"
} else {
port.open()
self.serialManager.connectTextViewToPort(with: self.outputView, to: port)
sender.title = "Close"
}
}
@IBAction func onClearOutput(_ sender: NSButton) {
Expand Down Expand Up @@ -149,7 +166,7 @@ public class SerialMonitorViewController: NSViewController {
panel.canCreateDirectories = true
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "mm-dd-yyyy hh:mm"
panel.nameFieldStringValue = "MakeLog-\(dateFormatter.string(from: Date())).txt"
panel.nameFieldStringValue = "SerialLog-\(dateFormatter.string(from: Date())).txt"
guard let mainWindow = NSApp.mainWindow else { return }
panel.beginSheetModal(for: mainWindow) { (response: NSApplication.ModalResponse) in
if response.rawValue == NSApplication.ModalResponse.OK.rawValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ NS_ASSUME_NONNULL_BEGIN
* ---------------------------------------------------------------------------------------
*/

@property (readonly) int fileDescriptor;
/**
* A Boolean value that indicates whether the port is open. (read-only)
*/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CSXSourceListViewController" customModule="CSXMake" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="CSXSourceListViewController" customModule="CSXToolchains" customModuleProvider="target">
<connections>
<outlet property="addItemButton" destination="xlp-Yy-5Sc" id="g8N-hn-jD9"/>
<outlet property="listTitle" destination="bYQ-1x-D4d" id="9Aq-YR-201"/>
Expand Down Expand Up @@ -50,9 +50,9 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bYQ-1x-D4d">
<rect key="frame" x="-2" y="146" width="37" height="17"/>
<rect key="frame" x="-2" y="146" width="40" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="5wE-m5-ZHi">
<font key="font" usesAppearanceFont="YES"/>
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand Down
Loading

0 comments on commit b8ddf20

Please sign in to comment.