|
2 | 2 | -- Navigation common module |
3 | 3 | --------------------------------------------------------------------------------------------------- |
4 | 4 | --[[ General configuration parameters ]] |
5 | | -config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0" |
| 5 | +config.mobileHost = "127.0.0.1" |
6 | 6 | config.defaultProtocolVersion = 2 |
7 | 7 |
|
8 | 8 | --[[ Required Shared libraries ]] |
|
370 | 370 | --! self - test object |
371 | 371 | --]] |
372 | 372 | 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 | + }) |
375 | 381 | end |
376 | 382 |
|
377 | 383 | --[[ @start: starting sequence: starting of SDL, initialization of HMI, connect mobile |
@@ -660,6 +666,24 @@ function commonNavigation.DelayedExp() |
660 | 666 | commonTestCases:DelayedExp(commonNavigation.timeout) |
661 | 667 | end |
662 | 668 |
|
| 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 | + |
663 | 687 | --[[ @protect: make table immutable |
664 | 688 | --! @parameters: |
665 | 689 | --! pTbl - mutable table |
|
0 commit comments