-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functions to query the iPhone model name and iOS version
Summary: This returns the name of the current platform, for example `iPhone14,2`, and the version of the OS that's is running on the current platform, for example `17.6.1`. This information will be used for the Hyperscape VRS files. Reviewed By: janherling Differential Revision: D65453491 fbshipit-source-id: 698d87fe5c9046a99e759a25a3562a3a0e235d15
- Loading branch information
1 parent
49d3238
commit 00a05bc
Showing
3 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#ifndef META_OCEAN_PLATFORM_APPLE_IOS_SYSTEM_H | ||
#define META_OCEAN_PLATFORM_APPLE_IOS_SYSTEM_H | ||
|
||
#include "ocean/platform/apple/ios/IOS.h" | ||
|
||
namespace Ocean | ||
{ | ||
|
||
namespace Platform | ||
{ | ||
|
||
namespace Apple | ||
{ | ||
|
||
namespace IOS | ||
{ | ||
|
||
/** | ||
* This class implements system functions on Apple iOS platforms. | ||
* @ingroup platformappleios | ||
*/ | ||
class System | ||
{ | ||
public: | ||
|
||
/** | ||
* Returns the name of the current iPhone model. | ||
* @param name The resulting name of the current device platform | ||
* @return True, if succeeded | ||
*/ | ||
static bool iphoneModelName(std::string& name); | ||
|
||
/** | ||
* Returns the version of iOS running on the current device. | ||
* @param version The resulting version of the operating system | ||
* @return True, if succeeded | ||
*/ | ||
static bool iosVersion(std::string& version); | ||
}; | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
#endif // META_OCEAN_PLATFORM_APPLE_IOS_SYSTEM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include "ocean/platform/apple/ios/System.h" | ||
|
||
#include <UIKit/UIKit.h> | ||
|
||
#import <sys/utsname.h> | ||
|
||
namespace Ocean | ||
{ | ||
|
||
namespace Platform | ||
{ | ||
|
||
namespace Apple | ||
{ | ||
|
||
namespace IOS | ||
{ | ||
|
||
bool System::iphoneModelName(std::string& name) | ||
{ | ||
struct utsname systemInfo; | ||
|
||
if (uname(&systemInfo) == 0) | ||
{ | ||
name = systemInfo.machine; | ||
return true; | ||
} | ||
|
||
name.clear(); | ||
|
||
return false; | ||
} | ||
|
||
bool System::iosVersion(std::string& version) | ||
{ | ||
version = [[[UIDevice currentDevice] systemVersion] UTF8String]; | ||
return true; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} |