3 Commits
v1.0 ... main

Author SHA1 Message Date
maddiebaka
ec8845ebc6 Merge commit 'f778b97' 2023-07-10 14:24:27 -04:00
maddiebaka
78450a85bb Commit partial changes 2023-06-27 18:42:04 -04:00
maddiebaka
e440f3489b Socket logic force disconnect/reconnect when server doesn't properly close it 2023-06-27 18:41:22 -04:00
15 changed files with 265 additions and 139 deletions

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "2.2">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<AutocreatedTestPlanReference>
</AutocreatedTestPlanReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E180B5E42992CD9100425DB0"
BuildableName = "Soyuz.app"
BlueprintName = "Soyuz"
ReferencedContainer = "container:Soyuz.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E180B5FA2992CD9300425DB0"
BuildableName = "SoyuzTests.xctest"
BlueprintName = "SoyuzTests"
ReferencedContainer = "container:Soyuz.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E180B6042992CD9300425DB0"
BuildableName = "SoyuzUITests.xctest"
BlueprintName = "SoyuzUITests"
ReferencedContainer = "container:Soyuz.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E180B5E42992CD9100425DB0"
BuildableName = "Soyuz.app"
BlueprintName = "Soyuz"
ReferencedContainer = "container:Soyuz.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E180B5E42992CD9100425DB0"
BuildableName = "Soyuz.app"
BlueprintName = "Soyuz"
ReferencedContainer = "container:Soyuz.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "DAF8C4E2-B59F-4B82-AB85-13AA83C729BF"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6CE8E079-8C71-49E3-9075-ED84DAB3B1D8"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SoyuzTests/MoonrakerSocketManagerTests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "70"
endingLineNumber = "70"
landmarkName = "setUp()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.RuntimeIssueBreakpoint">
<BreakpointContent
uuid = "01C24E12-6569-4AD6-87E9-63E4F37C4228"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
type = "65535">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E4DF5E8F-D6D9-450A-AD85-DB4722F31364"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SoyuzTests/MoonrakerSocketManagerTests.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
landmarkName = "setUp()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A14A53F8-609B-4A4E-8B15-208CD58339E0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Soyuz/Views/SoyuzMenuBarExtraView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "14"
endingLineNumber = "14"
landmarkName = "SoyuzMenuBarExtraView"
landmarkType = "14">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
uuid = "BC514915-414C-4AB7-86D8-F96569D06369"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__nwlog_err_simulate_crash"
moduleName = "">
<Locations>
<Location
uuid = "BC514915-414C-4AB7-86D8-F96569D06369 - 2fd95423b9cea3ab"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__nwlog_err_simulate_crash"
moduleName = "Network"
usesParentBreakpointCondition = "Yes"
offsetFromSymbolStart = "0">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@@ -1,9 +1,8 @@
//
// Persistence.swift
// KlipperMon
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import CoreData

View File

@@ -1,9 +1,8 @@
//
// KlipperMonApp.swift
// KlipperMon
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import SwiftUI
@@ -16,11 +15,6 @@ struct SoyuzApp: App {
@ObservedObject static var printerManager = MoonrakerSocketManager()
var body: some Scene {
// WindowGroup(id: "floating-stats") {
// KlipperMonMenuBarExtraView(currentMenuBarIcon: $currentIcon)
// .environment(\.managedObjectContext, persistenceController.container.viewContext)
// }
WindowGroup("Configuration", id: "soyuz_cfg", content: {
PrinterConfigView(printerManager: SoyuzApp.printerManager)
//.frame(minWidth: 300, maxWidth: 600, minHeight: 60, maxHeight: 100)

View File

@@ -1,9 +1,8 @@
//
// BonjourBrowser.swift
// Soyuz
//
// Created by maddiefuzz on 3/20/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import Foundation
import Network
@@ -89,50 +88,3 @@ class BonjourBrowser: ObservableObject {
}
}
}
//class BonjourBrowser: ObservableObject {
// @Published var NDEngineResults: [NWBrowser.Result] = []
//
// private let nwBrowser: NetworkDiscoveryEngine
// var connection: NWConnection!
//
// // TEMPORARY
//// var bonjourListener: NWListener?
//
// init(browser: NetworkDiscoveryEngine = NWBrowser(for: .bonjourWithTXTRecord(type: "_moonraker._tcp", domain: "local."), using: .tcp)) {
// nwBrowser = browser
// // Bonjour browser results changed handler
// nwBrowser.setBrowseResultsChangedHandler({ (newResults, changes) in
// print("[update] Results changed.")
// self.NDEngineResults.removeAll()
// newResults.forEach { result in
// print(result)
// self.NDEngineResults.append(result)
// }
// })
//
// // Bonjour browser state update handler
// nwBrowser.setStateUpdateHandler({ newState in
// switch newState {
// case .failed(let error):
// print("[error] nwbrowser: \(error)")
// case .ready:
// print("[ready] nwbrowser")
// case .setup:
// print("[setup] nwbrowser")
// default:
// break
// }
// })
//
// nwBrowser.startScan(queue: DispatchQueue.main)
// }
//
// func startScanning(queue: DispatchQueue.main) {
// if(self.nwBrowser.state == NWBrowser.State.cancelled) {
//
// }
// self.nwBrowser.startScan(queue)
// }
//
//}

View File

@@ -1,9 +1,8 @@
//
// MoonrakerSocketManager.swift
// KlipperMon
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import Foundation
import Network
@@ -69,11 +68,6 @@ class MoonrakerSocketManager: ObservableObject, WebSocketDelegate {
print("\(key): \(value)")
})
// if isConnected == true {
// connection?.cancel()
// socket?.disconnect()
// }
//
if connection == nil || connection?.state == .cancelled {
connection = NWConnection(to: endpoint, using: .tcp)
}

View File

@@ -1,9 +1,8 @@
//
// PrinterObjectsQuery.swift
// KlipperMon
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import Foundation

View File

@@ -1,9 +1,8 @@
//
// UserNotificationProtocol.swift
// Soyuz
//
// Created by Madeline Pace on 5/28/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import UserNotifications

View File

@@ -1,9 +1,8 @@
//
// PrinterConfigView.swift
// KlipperMon
//
// Created by maddiefuzz on 2/8/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import SwiftUI
import Network
@@ -13,11 +12,8 @@ struct PrinterConfigView: View {
@ObservedObject var printerManager: MoonrakerSocketManager
@ObservedObject var bonjourBrowser = BonjourBrowser()
//@State var bonjourBrowser = NWBrowser(for: .bonjourWithTXTRecord(type: "_moonraker._tcp", domain: "local."), using: .tcp)
@Environment(\.openURL) private var openURL
var body: some View {
VStack {
if(printerManager.isConnected) {

View File

@@ -1,9 +1,8 @@
//
// KlipperMonMenuBarExtraView.swift
// KlipperMon
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import SwiftUI
import UserNotifications
@@ -77,7 +76,6 @@ struct SoyuzMenuBarExtraView: View {
}
}
}
//.frame(minWidth: 220, minHeight: 100)
// Footer information
HStack {
Button {

View File

@@ -1,9 +1,8 @@
//
// BonjourBrowserTests.swift
// SoyuzTests
//
// Created by maddiefuzz on 3/24/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import XCTest
import Network

View File

@@ -1,9 +1,8 @@
//
// MoonrakerSocketManagerTests.swift
// SoyuzTests
//
// Created by maddiefuzz on 2/21/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import XCTest
import Starscream

View File

@@ -1,9 +1,8 @@
//
// KlipperMonTests.swift
// KlipperMonTests
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import XCTest
@testable import Soyuz

View File

@@ -1,9 +1,8 @@
//
// KlipperMonUITests.swift
// KlipperMonUITests
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import XCTest

View File

@@ -1,9 +1,8 @@
//
// KlipperMonUITestsLaunchTests.swift
// KlipperMonUITests
//
// Created by maddiefuzz on 2/7/23.
//
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import XCTest