Skip to content

Commit 569e744

Browse files
dboltovskyiGetmanetsIrina
authored andcommitted
Fix obtaining of MAC address and device Id
1 parent 1e66dcc commit 569e744

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

test_scripts/API/Navigation/commonNavigation.lua

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Navigation 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 ]]
@@ -370,8 +370,14 @@ end
370370
--! self - test object
371371
--]]
372372
local function allowSDL(self)
373-
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality",
374-
{ allowed = true, source = "GUI", device = { id = config.deviceMAC, name = "127.0.0.1" } })
373+
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {
374+
allowed = true,
375+
source = "GUI",
376+
device = {
377+
id = commonNavigation.getDeviceMAC(),
378+
name = commonNavigation.getDeviceName()
379+
}
380+
})
375381
end
376382

377383
--[[ @start: starting sequence: starting of SDL, initialization of HMI, connect mobile
@@ -660,6 +666,24 @@ function commonNavigation.DelayedExp()
660666
commonTestCases:DelayedExp(commonNavigation.timeout)
661667
end
662668

669+
--[[ @getDeviceName: return device name
670+
--! @parameters: none
671+
--]]
672+
function commonNavigation.getDeviceName()
673+
return config.mobileHost .. ":" .. config.mobilePort
674+
end
675+
676+
--[[ @getDeviceMAC: return device MAC address
677+
--! @parameters: none
678+
--]]
679+
function commonNavigation.getDeviceMAC()
680+
local cmd = "echo -n " .. commonNavigation.getDeviceName() .. " | sha256sum | awk '{printf $1}'"
681+
local handle = io.popen(cmd)
682+
local result = handle:read("*a")
683+
handle:close()
684+
return result
685+
end
686+
663687
--[[ @protect: make table immutable
664688
--! @parameters:
665689
--! pTbl - mutable table

0 commit comments

Comments
 (0)