121 with contextlib.suppress(OSError): |
121 with contextlib.suppress(OSError): |
122 self._deviceData = self.__getDeviceData() |
122 self._deviceData = self.__getDeviceData() |
123 self._deviceData["wifi"], self._deviceData["wifi_type"] = self.hasWifi() |
123 self._deviceData["wifi"], self._deviceData["wifi_type"] = self.hasWifi() |
124 self._deviceData["bluetooth"] = self.hasBluetooth() |
124 self._deviceData["bluetooth"] = self.hasBluetooth() |
125 self._deviceData["ethernet"] = self.hasEthernet() |
125 self._deviceData["ethernet"] = self.hasEthernet() |
|
126 self._deviceData["ntp"] = self.hasNetworkTime() |
126 |
127 |
127 def getDeviceType(self): |
128 def getDeviceType(self): |
128 """ |
129 """ |
129 Public method to get the device type. |
130 Public method to get the device type. |
130 |
131 |
1522 @rtype tuple of (dict, str) |
1523 @rtype tuple of (dict, str) |
1523 """ |
1524 """ |
1524 return {}, "" |
1525 return {}, "" |
1525 |
1526 |
1526 ################################################################## |
1527 ################################################################## |
|
1528 ## Methods below implement NTP related methods |
|
1529 ################################################################## |
|
1530 |
|
1531 def hasNetworkTime(self): |
|
1532 """ |
|
1533 Public method to check the availability of network time functions. |
|
1534 |
|
1535 @return flag indicating the availability of network time functions |
|
1536 @rtype bool |
|
1537 """ |
|
1538 return False |
|
1539 |
|
1540 def setNetworkTime(self, server="0.pool.ntp.org", tzOffset=0, timeout=10): |
|
1541 """ |
|
1542 Public method to set the time to the network time retrieved from an |
|
1543 NTP server. |
|
1544 |
|
1545 @param server name of the NTP server to get the network time from |
|
1546 (defaults to "0.pool.ntp.org") |
|
1547 @type str (optional) |
|
1548 @param tzOffset offset with respect to UTC (defaults to 0) |
|
1549 @type int (optional) |
|
1550 @param timeout maximum time to wait for a server response in seconds |
|
1551 (defaults to 10) |
|
1552 @type int |
|
1553 @return tuple containing a flag indicating success and an error string |
|
1554 @rtype tuple of (bool, str) |
|
1555 """ |
|
1556 return False, "" |
|
1557 |
|
1558 ################################################################## |
1527 ## Methods below implement some utility methods |
1559 ## Methods below implement some utility methods |
1528 ################################################################## |
1560 ################################################################## |
1529 |
1561 |
1530 def bool2str(self, val, capitalized=True): |
1562 def bool2str(self, val, capitalized=True): |
1531 """ |
1563 """ |