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 11 #ifndef SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ 12 #define SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ 13 14 #import <Foundation/Foundation.h> 15 #include <objc/objc.h> 16 17 #include <string> 18 19 namespace webrtc { 20 namespace ios { 21 22 bool CheckAndLogError(BOOL success, NSError* error); 23 24 NSString* NSStringFromStdString(const std::string& stdString); 25 std::string StdStringFromNSString(NSString* nsString); 26 27 // Return thread ID as a string. 28 std::string GetThreadId(); 29 30 // Return thread ID as string suitable for debug logging. 31 std::string GetThreadInfo(); 32 33 // Returns [NSThread currentThread] description as string. 34 // Example: <NSThread: 0x170066d80>{number = 1, name = main} 35 std::string GetCurrentThreadDescription(); 36 37 #if defined(WEBRTC_IOS) 38 // Returns the current name of the operating system. 39 std::string GetSystemName(); 40 41 // Returns the current version of the operating system as a string. 42 std::string GetSystemVersionAsString(); 43 44 // Returns the version of the operating system in double representation. 45 // Uses a cached value of the system version. 46 double GetSystemVersion(); 47 48 // Returns the device type. 49 // Examples: ”iPhone” and ”iPod touch”. 50 std::string GetDeviceType(); 51 #endif // defined(WEBRTC_IOS) 52 53 // Returns a more detailed device name. 54 // Examples: "iPhone 5s (GSM)" and "iPhone 6 Plus". 55 std::string GetDeviceName(); 56 57 // Returns the name of the process. Does not uniquely identify the process. 58 std::string GetProcessName(); 59 60 // Returns the identifier of the process (often called process ID). 61 int GetProcessID(); 62 63 // Returns a string containing the version of the operating system on which the 64 // process is executing. The string is string is human readable, localized, and 65 // is appropriate for displaying to the user. 66 std::string GetOSVersionString(); 67 68 // Returns the number of processing cores available on the device. 69 int GetProcessorCount(); 70 71 #if defined(WEBRTC_IOS) 72 // Indicates whether Low Power Mode is enabled on the iOS device. 73 bool GetLowPowerModeEnabled(); 74 #endif 75 76 } // namespace ios 77 } // namespace webrtc 78 79 #endif // SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ 80