Change PRM to MoonrakerSocketManager, project update

This commit is contained in:
Madeline Pace 2023-04-05 13:49:05 -04:00
parent d21fd9d331
commit 0f0d0c0628
28 changed files with 107 additions and 17 deletions

16
Soyuz.xcodeproj/project.pbxproj Normal file → Executable file
View File

@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
E124B9D929941A4D00C0D2D2 /* PrinterConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */; };
E16378B229A43CE1002F05E9 /* SoyuzScratchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */; };
E16378B429A491E6002F05E9 /* PrinterRequestManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */; };
E16378B429A491E6002F05E9 /* MoonrakerSocketManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */; };
E180B5E92992CD9100425DB0 /* SoyuzApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B5E82992CD9100425DB0 /* SoyuzApp.swift */; };
E180B5ED2992CD9200425DB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E180B5EC2992CD9200425DB0 /* Assets.xcassets */; };
E180B5F02992CD9200425DB0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E180B5EF2992CD9200425DB0 /* Preview Assets.xcassets */; };
@ -20,7 +20,7 @@
E180B60C2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B60B2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift */; };
E180B61D2992D53700425DB0 /* PrinterObjectsQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */; };
E180B61F2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */; };
E180B6222993256E00425DB0 /* PrinterRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B6212993256E00425DB0 /* PrinterRequestManager.swift */; };
E180B6222993256E00425DB0 /* MoonrakerSocketManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */; };
E1A93C6729C932E200BAE750 /* BonjourBrowser.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */; };
E1A93C6929CD627100BAE750 /* BonjourBrowserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */; };
E1E8B07729949E2700BABE4B /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = E1E8B07629949E2700BABE4B /* Starscream */; };
@ -47,7 +47,7 @@
E124B9D72993FE5500C0D2D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterConfigView.swift; sourceTree = "<group>"; };
E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzScratchTests.swift; sourceTree = "<group>"; };
E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterRequestManagerTests.swift; sourceTree = "<group>"; };
E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoonrakerSocketManager.swift; sourceTree = "<group>"; };
E180B5E52992CD9100425DB0 /* Soyuz.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Soyuz.app; sourceTree = BUILT_PRODUCTS_DIR; };
E180B5E82992CD9100425DB0 /* SoyuzApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzApp.swift; sourceTree = "<group>"; };
E180B5EC2992CD9200425DB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@ -62,7 +62,7 @@
E180B60B2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzUITestsLaunchTests.swift; sourceTree = "<group>"; };
E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterObjectsQuery.swift; sourceTree = "<group>"; };
E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzMenuBarExtraView.swift; sourceTree = "<group>"; };
E180B6212993256E00425DB0 /* PrinterRequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterRequestManager.swift; sourceTree = "<group>"; };
E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoonrakerSocketManager.swift; sourceTree = "<group>"; };
E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonjourBrowser.swift; sourceTree = "<group>"; };
E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BonjourBrowserTests.swift; path = SoyuzTests/BonjourBrowserTests.swift; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
@ -143,7 +143,7 @@
E180B5FF2992CD9300425DB0 /* SoyuzTests.swift */,
E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */,
E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */,
E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */,
E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */,
);
path = SoyuzTests;
sourceTree = "<group>";
@ -170,7 +170,7 @@
isa = PBXGroup;
children = (
E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */,
E180B6212993256E00425DB0 /* PrinterRequestManager.swift */,
E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */,
E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */,
);
path = ViewModels;
@ -318,7 +318,7 @@
E180B5F22992CD9200425DB0 /* Persistence.swift in Sources */,
E1A93C6729C932E200BAE750 /* BonjourBrowser.swift in Sources */,
E180B5E92992CD9100425DB0 /* SoyuzApp.swift in Sources */,
E180B6222993256E00425DB0 /* PrinterRequestManager.swift in Sources */,
E180B6222993256E00425DB0 /* MoonrakerSocketManager.swift in Sources */,
E180B61F2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -328,7 +328,7 @@
buildActionMask = 2147483647;
files = (
E180B6002992CD9300425DB0 /* SoyuzTests.swift in Sources */,
E16378B429A491E6002F05E9 /* PrinterRequestManagerTests.swift in Sources */,
E16378B429A491E6002F05E9 /* MoonrakerSocketManager.swift in Sources */,
E1A93C6929CD627100BAE750 /* BonjourBrowserTests.swift in Sources */,
E16378B229A43CE1002F05E9 /* SoyuzScratchTests.swift in Sources */,
);

0
Soyuz.xcodeproj/project.xcworkspace/contents.xcworkspacedata generated Normal file → Executable file
View File

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Soyuz.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

View File

@ -20,5 +20,53 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E361E24C-A6D3-4C02-B11D-290874A15033"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SoyuzTests/MoonrakerSocketManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
landmarkName = "testBlah()"
landmarkType = "7">
<Locations>
<Location
uuid = "E361E24C-A6D3-4C02-B11D-290874A15033 - 16ea1fa406b6a8b5"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SoyuzTests.PrinterRequestManagerTests.testBlah() -&gt; ()"
moduleName = "SoyuzTests"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/SNAP/Users/averyadapace/Code/MacOS/KlipperMon/SoyuzTests/MoonrakerSocketManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
offsetFromSymbolStart = "404">
</Location>
<Location
uuid = "E361E24C-A6D3-4C02-B11D-290874A15033 - 16ea1fa406b6a8b5"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "SoyuzTests.PrinterRequestManagerTests.testBlah() -&gt; ()"
moduleName = "SoyuzTests"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/SNAP/Users/averyadapace/Code/MacOS/KlipperMon/SoyuzTests/MoonrakerSocketManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
offsetFromSymbolStart = "820">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

0
Soyuz/Assets.xcassets/AppIcon.appiconset/Contents.json Normal file → Executable file
View File

0
Soyuz/Assets.xcassets/Contents.json Normal file → Executable file
View File

0
Soyuz/Info.plist Normal file → Executable file
View File

0
Soyuz/KlipperMon.xcdatamodeld/.xccurrentversion Normal file → Executable file
View File

View File

0
Soyuz/Persistence.swift Normal file → Executable file
View File

View File

0
Soyuz/Soyuz.entitlements Normal file → Executable file
View File

2
Soyuz/SoyuzApp.swift Normal file → Executable file
View File

@ -13,7 +13,7 @@ struct SoyuzApp: App {
@State var currentIcon = "move.3d"
@ObservedObject static var printerManager = PrinterRequestManager()
@ObservedObject static var printerManager = MoonrakerSocketManager()
var body: some Scene {
// WindowGroup(id: "floating-stats") {

0
Soyuz/ViewModels/BonjourBrowser.swift Normal file → Executable file
View File

View File

@ -13,7 +13,7 @@ import Starscream
// MARK: PrinterRequestManager
//@MainActor
class PrinterRequestManager: ObservableObject, WebSocketDelegate {
class MoonrakerSocketManager: ObservableObject, WebSocketDelegate {
let WEBSOCKET_TIMEOUT_INTERVAL: TimeInterval = 60.0
// Websocket JSON-RPC published data

0
Soyuz/ViewModels/PrinterObjectsQuery.swift Normal file → Executable file
View File

4
Soyuz/Views/PrinterConfigView.swift Normal file → Executable file
View File

@ -10,7 +10,7 @@ import Network
// MARK: PrinterConfigView
struct PrinterConfigView: View {
@ObservedObject var printerManager: PrinterRequestManager
@ObservedObject var printerManager: MoonrakerSocketManager
@ObservedObject var bonjourBrowser = BonjourBrowser()
var body: some View {
@ -54,7 +54,7 @@ struct PrinterConfigView: View {
}
struct PrinterConfigView_Previews: PreviewProvider {
@State static var printerManager = PrinterRequestManager()
@State static var printerManager = MoonrakerSocketManager()
static var previews: some View {
PrinterConfigView(printerManager: printerManager)

5
Soyuz/Views/SoyuzMenuBarExtraView.swift Normal file → Executable file
View File

@ -11,11 +11,12 @@ import Network
struct SoyuzMenuBarExtraView: View {
// The threshhold considered a burn-risk, at which point certain UI elements turn red.
// Measured in degrees Celsius
let DANGERTEMP = 40.0
@Environment(\.openWindow) var openWindow
@ObservedObject var printerManager: PrinterRequestManager
@ObservedObject var printerManager: MoonrakerSocketManager
@State var printPercentage: Double = 0
@ -100,7 +101,7 @@ struct SoyuzMenuBarExtraView: View {
struct KlipperMonMenuBarExtraView_Previews: PreviewProvider {
@State static var currentMenuBarIcon = "move.3d"
@State static var printerManager = PrinterRequestManager()
@State static var printerManager = MoonrakerSocketManager()
static var previews: some View {
SoyuzMenuBarExtraView(printerManager: printerManager, currentMenuBarIcon: $currentMenuBarIcon)

2
SoyuzTests/BonjourBrowserTests.swift Normal file → Executable file
View File

@ -29,7 +29,7 @@ class SoyuzBonjourBrowserTests: XCTestCase {
bonjourBrowser = BonjourBrowser(browser: NWBrowser(for: .bonjour(type: "_xctest._tcp", domain: "local."), using: .tcp))
}
func testBonjourDiscoveredItemsNotNil() {
func testBonjourDiscoveredItemsPopulated() {
guard let browser = bonjourBrowser else {
XCTAssert(false)
return

View File

@ -6,13 +6,40 @@
//
import XCTest
import Starscream
import Network
@testable import Soyuz
class PrinterRequestManagerTests: XCTestCase {
var printerRequestManager: PrinterRequestManager?
var socketManager: MoonrakerSocketManager?
var testBonjourListener: NWListener?
// Server-side test variables
let server = WebSocketServer()
let address = "localhost"
let port: UInt16 = 80
override func setUp() {
let server = WebSocketServer()
let error = server.start(address: address, port: port)
if let err = error {
print("Error starting WebSocket server: \(err)")
}
socketManager = MoonrakerSocketManager()
}
func testBlah() {
guard let url = URL(string: "\(address):\(port)") else {
return
}
print("Success")
let endpoint = NWEndpoint.url(url)
print(endpoint.debugDescription)
socketManager?.connectToBonjourEndpoint(endpoint)
return
}
// override func setUp() {
// printerRequestManager = PrinterRequestManager(browser: NWBrowser(for: .bonjour(type: "_http._tcp", domain: "local."), using: .tcp))

0
SoyuzTests/SoyuzScratchTests.swift Normal file → Executable file
View File

0
SoyuzTests/SoyuzTests.swift Normal file → Executable file
View File

0
SoyuzUITests/SoyuzUITests.swift Normal file → Executable file
View File

0
SoyuzUITests/SoyuzUITestsLaunchTests.swift Normal file → Executable file
View File