Skip to content

Commit 6b19289

Browse files
committed
chore: Add file transfer capabilities for windows devices
Add file transfer capabilities for windows devices Signed-off-by: ArnelaL <arnela.lisic@secomind.com>
1 parent 1225165 commit 6b19289

4 files changed

Lines changed: 119 additions & 13 deletions

File tree

backend/lib/edgehog/capabilities.ex

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ defmodule Edgehog.Capabilities do
133133
minor: 1
134134
}
135135
],
136-
file_transfer_stream: [
136+
posix_file_transfer_stream: [
137137
%Astarte.InterfaceID{
138138
name: "io.edgehog.devicemanager.fileTransfer.posix.ServerToDevice",
139139
major: 0,
@@ -150,7 +150,7 @@ defmodule Edgehog.Capabilities do
150150
minor: 1
151151
}
152152
],
153-
file_transfer_storage: [
153+
posix_file_transfer_storage: [
154154
%Astarte.InterfaceID{
155155
name: "io.edgehog.devicemanager.fileTransfer.posix.ServerToDevice",
156156
major: 0,
@@ -172,6 +172,45 @@ defmodule Edgehog.Capabilities do
172172
minor: 1
173173
}
174174
],
175+
windows_file_transfer_stream: [
176+
%Astarte.InterfaceID{
177+
name: "io.edgehog.devicemanager.fileTransfer.windows.ServerToDevice",
178+
major: 0,
179+
minor: 1
180+
},
181+
%Astarte.InterfaceID{
182+
name: "io.edgehog.devicemanager.fileTransfer.Progress",
183+
major: 0,
184+
minor: 1
185+
},
186+
%Astarte.InterfaceID{
187+
name: "io.edgehog.devicemanager.fileTransfer.Response",
188+
major: 0,
189+
minor: 1
190+
}
191+
],
192+
windows_file_transfer_storage: [
193+
%Astarte.InterfaceID{
194+
name: "io.edgehog.devicemanager.fileTransfer.windows.ServerToDevice",
195+
major: 0,
196+
minor: 1
197+
},
198+
%Astarte.InterfaceID{
199+
name: "io.edgehog.devicemanager.fileTransfer.Progress",
200+
major: 0,
201+
minor: 1
202+
},
203+
%Astarte.InterfaceID{
204+
name: "io.edgehog.devicemanager.fileTransfer.Response",
205+
major: 0,
206+
minor: 1
207+
},
208+
%Astarte.InterfaceID{
209+
name: "io.edgehog.devicemanager.storage.File",
210+
major: 0,
211+
minor: 1
212+
}
213+
],
175214
file_transfer_read: [
176215
%Astarte.InterfaceID{
177216
name: "io.edgehog.devicemanager.fileTransfer.DeviceToServer",

backend/lib/edgehog/devices/device/types/capability.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ defmodule Edgehog.Devices.Device.Types.Capability do
2727
cellular_connection: "The device provides information about its cellular connection.",
2828
commands: "The device supports commands, for example the rebooting command.",
2929
container_management: "The device supports running applications using containers.",
30-
file_transfer_stream: "The device supports streaming files to and from it.",
31-
file_transfer_storage: "The device supports transferring files to and from its storage units.",
30+
posix_file_transfer_stream: "The device supports streaming files to and from it.",
31+
posix_file_transfer_storage: "The device supports transferring files to and from its storage units.",
32+
windows_file_transfer_storage: "The device supports transferring files to and from its storage units.",
33+
windows_file_transfer_stream: "The device supports streaming files to and from it.",
3234
file_transfer_read: "The device supports reading files from it.",
3335
geolocation: "The device can be geolocated.",
3436
hardware_info: "The device provides information about its hardware.",

backend/test/edgehog/capabilities_test.exs

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ defmodule Edgehog.CapabilitiesTest do
6262
major: 0,
6363
minor: 1
6464
},
65+
"io.edgehog.devicemanager.fileTransfer.windows.ServerToDevice" => %InterfaceVersion{
66+
major: 0,
67+
minor: 1
68+
},
6569
"io.edgehog.devicemanager.fileTransfer.DeviceToServer" => %InterfaceVersion{
6670
major: 0,
6771
minor: 1
@@ -114,8 +118,10 @@ defmodule Edgehog.CapabilitiesTest do
114118
:cellular_connection,
115119
:commands,
116120
:container_management,
117-
:file_transfer_stream,
118-
:file_transfer_storage,
121+
:posix_file_transfer_stream,
122+
:posix_file_transfer_storage,
123+
:windows_file_transfer_stream,
124+
:windows_file_transfer_storage,
119125
:file_transfer_read,
120126
:geolocation,
121127
:hardware_info,
@@ -226,7 +232,7 @@ defmodule Edgehog.CapabilitiesTest do
226232
assert Enum.sort(expected_capabilities) == Enum.sort(device_capabilities)
227233
end
228234

229-
test "returns file_transfer_stream capability when all required interfaces are present" do
235+
test "returns posix_file_transfer_stream capability when all required interfaces are present" do
230236
device_introspection = %{
231237
"io.edgehog.devicemanager.fileTransfer.posix.ServerToDevice" => %InterfaceVersion{
232238
major: 0,
@@ -243,7 +249,7 @@ defmodule Edgehog.CapabilitiesTest do
243249
}
244250

245251
expected_capabilities = [
246-
:file_transfer_stream,
252+
:posix_file_transfer_stream,
247253
:geolocation
248254
]
249255

@@ -252,7 +258,7 @@ defmodule Edgehog.CapabilitiesTest do
252258
assert Enum.sort(expected_capabilities) == Enum.sort(device_capabilities)
253259
end
254260

255-
test "returns file_transfer_storage capability when all required interfaces are present" do
261+
test "returns posix_file_transfer_storage capability when all required interfaces are present" do
256262
device_introspection = %{
257263
"io.edgehog.devicemanager.fileTransfer.posix.ServerToDevice" => %InterfaceVersion{
258264
major: 0,
@@ -273,8 +279,65 @@ defmodule Edgehog.CapabilitiesTest do
273279
}
274280

275281
expected_capabilities = [
276-
:file_transfer_storage,
277-
:file_transfer_stream,
282+
:posix_file_transfer_storage,
283+
:posix_file_transfer_stream,
284+
:geolocation
285+
]
286+
287+
device_capabilities = Capabilities.from_introspection(device_introspection)
288+
289+
assert Enum.sort(expected_capabilities) == Enum.sort(device_capabilities)
290+
end
291+
292+
test "returns windows_file_transfer_stream capability when all required interfaces are present" do
293+
device_introspection = %{
294+
"io.edgehog.devicemanager.fileTransfer.windows.ServerToDevice" => %InterfaceVersion{
295+
major: 0,
296+
minor: 1
297+
},
298+
"io.edgehog.devicemanager.fileTransfer.Progress" => %InterfaceVersion{
299+
major: 0,
300+
minor: 1
301+
},
302+
"io.edgehog.devicemanager.fileTransfer.Response" => %InterfaceVersion{
303+
major: 0,
304+
minor: 1
305+
}
306+
}
307+
308+
expected_capabilities = [
309+
:windows_file_transfer_stream,
310+
:geolocation
311+
]
312+
313+
device_capabilities = Capabilities.from_introspection(device_introspection)
314+
315+
assert Enum.sort(expected_capabilities) == Enum.sort(device_capabilities)
316+
end
317+
318+
test "returns windows_file_transfer_storage capability when all required interfaces are present" do
319+
device_introspection = %{
320+
"io.edgehog.devicemanager.fileTransfer.windows.ServerToDevice" => %InterfaceVersion{
321+
major: 0,
322+
minor: 1
323+
},
324+
"io.edgehog.devicemanager.fileTransfer.Progress" => %InterfaceVersion{
325+
major: 0,
326+
minor: 1
327+
},
328+
"io.edgehog.devicemanager.fileTransfer.Response" => %InterfaceVersion{
329+
major: 0,
330+
minor: 1
331+
},
332+
"io.edgehog.devicemanager.storage.File" => %InterfaceVersion{
333+
major: 0,
334+
minor: 1
335+
}
336+
}
337+
338+
expected_capabilities = [
339+
:windows_file_transfer_storage,
340+
:windows_file_transfer_stream,
278341
:geolocation
279342
]
280343

backend/test/edgehog_web/schema/query/device_test.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,10 @@ defmodule EdgehogWeb.Schema.Query.DeviceTest do
734734
"CELLULAR_CONNECTION",
735735
"COMMANDS",
736736
"CONTAINER_MANAGEMENT",
737-
"FILE_TRANSFER_STREAM",
738-
"FILE_TRANSFER_STORAGE",
737+
"POSIX_FILE_TRANSFER_STREAM",
738+
"POSIX_FILE_TRANSFER_STORAGE",
739+
"WINDOWS_FILE_TRANSFER_STREAM",
740+
"WINDOWS_FILE_TRANSFER_STORAGE",
739741
"FILE_TRANSFER_READ",
740742
"GEOLOCATION",
741743
"HARDWARE_INFO",

0 commit comments

Comments
 (0)