Skip to content

Commit 2d87de4

Browse files
dboltovskyiGetmanetsIrina
authored andcommitted
Fix obtaining of MAC address and device Id
1 parent 5fc166a commit 2d87de4

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

test_scripts/API/Navigation/commonSendLocation.lua

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- SendLocation common module
33
---------------------------------------------------------------------------------------------------
44
--[[ General configuration parameters ]]
5-
config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"
5+
config.mobileHost = "127.0.0.1"
66
config.defaultProtocolVersion = 2
77

88
--[[ Required Shared libraries ]]
@@ -50,8 +50,14 @@ local function getAvailableParams()
5050
end
5151

5252
local function allowSDL(self)
53-
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality",
54-
{ allowed = true, source = "GUI", device = { id = config.deviceMAC, name = "127.0.0.1" } })
53+
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {
54+
allowed = true,
55+
source = "GUI",
56+
device = {
57+
id = commonSendLocation.getDeviceMAC(),
58+
name = commonSendLocation.getDeviceName()
59+
}
60+
})
5561
end
5662

5763
local function checkIfPTSIsSentAsBinary(bin_data)
@@ -181,8 +187,16 @@ function commonSendLocation.delayedExp(timeout)
181187
commonTestCases:DelayedExp(timeout)
182188
end
183189

190+
function commonSendLocation.getDeviceName()
191+
return config.mobileHost .. ":" .. config.mobilePort
192+
end
193+
184194
function commonSendLocation.getDeviceMAC()
185-
return config.deviceMAC
195+
local cmd = "echo -n " .. commonSendLocation.getDeviceName() .. " | sha256sum | awk '{printf $1}'"
196+
local handle = io.popen(cmd)
197+
local result = handle:read("*a")
198+
handle:close()
199+
return result
186200
end
187201

188202
function commonSendLocation.getSelfAndParams(...)

0 commit comments

Comments
 (0)