diff --git a/.gitmodules b/.gitmodules index b3dbd1c..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "Sources/DataAcquisition"] - path = Sources/DataAcquisition - url = https://repositories.communitynotfound.work/PoliBa-Software-Architecture/embeddedLibrary.git diff --git a/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift b/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift index ece961a..5396a4c 100644 --- a/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift +++ b/Sources/IoT-Simulator-Core/Classes/Utils/Field.swift @@ -1,5 +1,5 @@ -public class Field { +public class Field : Codable{ public let key: String public let value: String diff --git a/Sources/IoT-Simulator-Core/Utils/MessageBytes.md b/Sources/IoT-Simulator-Core/Utils/MessageBytes.md new file mode 100644 index 0000000..1849108 --- /dev/null +++ b/Sources/IoT-Simulator-Core/Utils/MessageBytes.md @@ -0,0 +1,54 @@ +# Message Structure +``` ++-- 64 - bits---+----------------+-------------+----------------+-----------------------+ +| Version 8 | Message Type 8 | Dev Type 8 | RESERVED 8 | Sign Type 32 | ++---------------+----------------+-------------+----------------+-----------------------+ +| Timestamp 64 | ++---------------------------------------------------------------------------------------+ +| DevID 128 bits | +| | ++---------------------------------------------------------------------------------------+ +| Location 192 bits | +| | +| | ++---------------------------------------------------------------------------------------+ +\ / + | Fields -----------------------------------------------------------------------------| +/ \ ++---------------------------------------------------------------------------------------+ +| 0 Padding 64 - n | ++---------------------------------------------------------------------------------------+ +| 0 FIELD STOP 64 | ++---------------------------------------------------------------------------------------+ +| Signature up to-512 bits | +| | +| | +| | +| | +| | +| | +| | ++---------------------------------------------------------------------------------------+ +``` + +# Fields +each field can be at most 8 * 2^32 bits of length: +- 34359738368 bits +- 4294967296 Bytes + +## Key +**MUST** be a `String` + +## Value +It's up to the Application to decide whether the value is +a string or another type of datum + +``` ++-- 64 - bits--------------------------+----------------------------------------+ +| Key-Length 32 | Value-Length 32 | ++--------------------------------------+----------------------------------------+ +\ Key / + |-----------------------------------------------------------------------------| +/ Value \ ++-------------------------------------------------------------------------------+ +``` \ No newline at end of file diff --git a/Sources/IoT-Simulator-Core/Utils/Security.swift b/Sources/IoT-Simulator-Core/Utils/Security.swift index b84b4a6..a2000c9 100644 --- a/Sources/IoT-Simulator-Core/Utils/Security.swift +++ b/Sources/IoT-Simulator-Core/Utils/Security.swift @@ -2,6 +2,7 @@ import Crypto // Equivalent to CryptoKit (more or less) import Foundation + // ------------------ // --- Sign --------- // ------------------ diff --git a/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift b/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift index 3206c5a..8d958a2 100644 --- a/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift +++ b/Tests/IoT-Simulator-CoreTests/IoTCore-Tests.swift @@ -66,7 +66,7 @@ import Testing @Test func stressLoop1() async throws { - let devices: Int = 5000 + let devices: Int = 1000 let env = PhysicalEnvironment("Delta") let truth = PhysicalData(.Temperature, 22)