forked from erica/uidevice-extension
-
Notifications
You must be signed in to change notification settings - Fork 1
/
UIDevice-Hardware.h
76 lines (65 loc) · 1.97 KB
/
UIDevice-Hardware.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
Erica Sadun, http://ericasadun.com
iPhone Developer's Cookbook, 3.0 Edition
BSD License, Use at your own risk
*/
#import <UIKit/UIKit.h>
#define IPHONE_1G_NAMESTRING @"iPhone 1G"
#define IPHONE_3G_NAMESTRING @"iPhone 3G"
#define IPHONE_3GS_NAMESTRING @"iPhone 3G S"
#define IPHONE_UNKNOWN_NAMESTRING @"Unknown iPhone"
#define IPOD_1G_NAMESTRING @"iPod touch 1G"
#define IPOD_2G_NAMESTRING @"iPod touch 2G"
#define IPOD_UNKNOWN_NAMESTRING @"Unknown iPod"
#define IPOD_FAMILY_UNKNOWN_DEVICE @"Unknown device in the iPhone/iPod family"
#define IPHONE_SIMULATOR_NAMESTRING @"iPhone Simulator"
typedef enum {
UIDeviceUnknown,
UIDeviceiPhoneSimulator,
UIDevice1GiPhone,
UIDevice1GiPod,
UIDevice3GiPhone,
UIDevice3GSiPhone,
UIDevice2GiPod,
UIDeviceUnknowniPhone,
UIDeviceUnknowniPod,
} UIDevicePlatform;
typedef enum {
UIDeviceFirmware2,
UIDeviceFirmware3,
} UIDeviceFirmware;
enum {
UIDeviceSupportsGPS = 1 << 0,
UIDeviceBuiltInSpeaker = 1 << 1,
UIDeviceBuiltInCamera = 1 << 2,
UIDeviceBuiltInMicrophone = 1 << 3,
UIDeviceSupportsExternalMicrophone = 1 << 4,
UIDeviceSupportsTelephony = 1 << 5,
UIDeviceSupportsVibration = 1 << 6,
UIDeviceBuiltInProximitySensor = 1 << 7,
UIDeviceSupportsVideoRecording = 1 << 8,
UIDeviceSupportsCompass = 1 << 9,
UIDeviceSupportsAccessibility = 1 << 10,
UIDeviceSupportsVoiceControl = 1 << 11,
UIDeviceSupportsBluetooth = 1 << 12,
};
@interface UIDevice (Hardware)
- (NSString *) platform;
- (NSUInteger) platformType;
- (NSUInteger) platformCapabilities;
- (NSString *) platformString;
- (NSUInteger) cpuFrequency;
- (NSUInteger) busFrequency;
- (NSUInteger) totalMemory;
- (NSUInteger) userMemory;
- (NSUInteger) maxSocketBufferSize;
- (NSString *) macaddress;
@end
@interface UIDevice (Orientation)
- (BOOL) isLandscape;
- (BOOL) isPortrait;
- (NSString *) orientationString;
@property (nonatomic, readonly) BOOL isLandscape;
@property (nonatomic, readonly) BOOL isPortrait;
@property (nonatomic, readonly) NSString *orientationString;
@end