-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
2,276 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--indent 4 | ||
--indentcase false | ||
--trimwhitespace always | ||
--voidtype tuple | ||
--nospaceoperators ..<,... | ||
--ifdef noindent | ||
--stripunusedargs closure-only | ||
--maxwidth 100 | ||
--wraparguments before-first | ||
--funcattributes prev-line | ||
--typeattributes prev-line | ||
--varattributes prev-line | ||
--disable andOperator | ||
--swiftversion 5.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
disabled_rules: | ||
- trailing_comma | ||
- identifier_name | ||
- void_return | ||
- operator_whitespace | ||
- nesting | ||
- cyclomatic_complexity | ||
- multiple_closures_with_trailing_closure | ||
- type_name | ||
- todo | ||
- large_tuple | ||
- opening_brace | ||
|
||
line_length: 100 | ||
|
||
function_body_length: | ||
- 50 | ||
|
||
included: | ||
- Sources | ||
- Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Foundation | ||
import SwiftOCA | ||
import SwiftOCADevice | ||
|
||
private var localhost = sockaddr_in( | ||
sin_len: UInt8(MemoryLayout<sockaddr_in>.size), | ||
sin_family: sa_family_t(AF_INET), | ||
sin_port: in_port_t(65000).bigEndian, | ||
sin_addr: in_addr(s_addr: INADDR_ANY), | ||
sin_zero: (0, 0, 0, 0, 0, 0, 0, 0) | ||
) | ||
|
||
class TestActuator: SwiftOCADevice.OcaBooleanActuator { | ||
override public func handleCommand( | ||
_ command: Ocp1Command, | ||
from controller: AES70OCP1Controller | ||
) async throws -> Ocp1Response { | ||
debugPrint("got command \(command) from controller \(controller)") | ||
return try await super.handleCommand(command, from: controller) | ||
} | ||
} | ||
|
||
@main | ||
public enum DeviceApp { | ||
static var testActuator: SwiftOCADevice.OcaBooleanActuator? | ||
|
||
public static func main() async throws { | ||
var device: AES70OCP1Device! | ||
|
||
withUnsafePointer(to: &localhost) { | ||
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) { cSockAddr in | ||
device = AES70OCP1Device(address: cSockAddr) | ||
} | ||
} | ||
|
||
testActuator = try await SwiftOCADevice.OcaBooleanActuator( | ||
role: "Test Actuator", | ||
deviceDelegate: device | ||
) | ||
try await device.start() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.