Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
kthelgason | a71ddad | 2017-05-30 08:48:47 | [diff] [blame] | 11 | #ifndef WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ |
| 12 | #define WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 13 | |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 14 | #include <string> |
| 15 | |
| 16 | namespace webrtc { |
| 17 | namespace ios { |
| 18 | |
| 19 | bool CheckAndLogError(BOOL success, NSError* error); |
| 20 | |
kthelgason | 2925ab9 | 2017-01-09 09:40:03 | [diff] [blame] | 21 | NSString *NSStringFromStdString(const std::string& stdString); |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 22 | std::string StdStringFromNSString(NSString* nsString); |
| 23 | |
| 24 | // Return thread ID as a string. |
| 25 | std::string GetThreadId(); |
| 26 | |
| 27 | // Return thread ID as string suitable for debug logging. |
| 28 | std::string GetThreadInfo(); |
| 29 | |
| 30 | // Returns [NSThread currentThread] description as string. |
| 31 | // Example: <NSThread: 0x170066d80>{number = 1, name = main} |
| 32 | std::string GetCurrentThreadDescription(); |
| 33 | |
kthelgason | c9f456b | 2017-07-25 14:55:58 | [diff] [blame] | 34 | #if defined(WEBRTC_IOS) |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 35 | // Returns the current name of the operating system. |
| 36 | std::string GetSystemName(); |
| 37 | |
henrika | 11ff825 | 2016-03-03 15:59:50 | [diff] [blame] | 38 | // Returns the current version of the operating system as a string. |
| 39 | std::string GetSystemVersionAsString(); |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 40 | |
henrika | 11ff825 | 2016-03-03 15:59:50 | [diff] [blame] | 41 | // Returns the version of the operating system in double representation. |
| 42 | // Uses a cached value of the system version. |
| 43 | double GetSystemVersion(); |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 44 | |
| 45 | // Returns the device type. |
| 46 | // Examples: ”iPhone” and ”iPod touch”. |
| 47 | std::string GetDeviceType(); |
kthelgason | c9f456b | 2017-07-25 14:55:58 | [diff] [blame] | 48 | #endif // defined(WEBRTC_IOS) |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 49 | |
| 50 | // Returns a more detailed device name. |
| 51 | // Examples: "iPhone 5s (GSM)" and "iPhone 6 Plus". |
| 52 | std::string GetDeviceName(); |
| 53 | |
henrika | b2f0e5d | 2016-02-24 13:27:09 | [diff] [blame] | 54 | // Returns the name of the process. Does not uniquely identify the process. |
| 55 | std::string GetProcessName(); |
| 56 | |
| 57 | // Returns the identifier of the process (often called process ID). |
| 58 | int GetProcessID(); |
| 59 | |
| 60 | // Returns a string containing the version of the operating system on which the |
| 61 | // process is executing. The string is string is human readable, localized, and |
| 62 | // is appropriate for displaying to the user. |
| 63 | std::string GetOSVersionString(); |
| 64 | |
| 65 | // Returns the number of processing cores available on the device. |
| 66 | int GetProcessorCount(); |
| 67 | |
kthelgason | c9f456b | 2017-07-25 14:55:58 | [diff] [blame] | 68 | #if defined(WEBRTC_IOS) |
henrika | b2f0e5d | 2016-02-24 13:27:09 | [diff] [blame] | 69 | // Indicates whether Low Power Mode is enabled on the iOS device. |
| 70 | bool GetLowPowerModeEnabled(); |
kthelgason | c9f456b | 2017-07-25 14:55:58 | [diff] [blame] | 71 | #endif |
henrika | b2f0e5d | 2016-02-24 13:27:09 | [diff] [blame] | 72 | |
Henrik Kjellander | 36a14b5 | 2015-11-04 07:31:52 | [diff] [blame] | 73 | } // namespace ios |
| 74 | } // namespace webrtc |
| 75 | |
kthelgason | a71ddad | 2017-05-30 08:48:47 | [diff] [blame] | 76 | #endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ |