Skip to content

Commit

Permalink
Adding tablet stand-in
Browse files Browse the repository at this point in the history
  • Loading branch information
Erica Sadun authored and Erica Sadun committed Jan 14, 2010
1 parent 51f7a69 commit 0a970a5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions UIDevice-Hardware.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define IPROD_1G_NAMESTRING @"iProd 1G" #define IPROD_1G_NAMESTRING @"iProd 1G"
#define IPROD_2G_NAMESTRING @"iProd 2G" #define IPROD_2G_NAMESTRING @"iProd 2G"


#define TABLET_1G_NAMESTRING @"Tablet"

#define IPOD_FAMILY_UNKNOWN_DEVICE @"Unknown device in the iPhone/iPod family" #define IPOD_FAMILY_UNKNOWN_DEVICE @"Unknown device in the iPhone/iPod family"


#define IPHONE_SIMULATOR_NAMESTRING @"iPhone Simulator" #define IPHONE_SIMULATOR_NAMESTRING @"iPhone Simulator"
Expand All @@ -40,6 +42,7 @@ typedef enum {
UIDevice2GPlusiPod, UIDevice2GPlusiPod,
UIDevice3GiPod, UIDevice3GiPod,
UIDevice4GiPod, UIDevice4GiPod,
UIDevice1GTablet,
UIDeviceUnknowniPhone, UIDeviceUnknowniPhone,
UIDeviceUnknowniPod, UIDeviceUnknowniPod,
UIDeviceIFPGA, UIDeviceIFPGA,
Expand All @@ -50,6 +53,7 @@ typedef enum {
typedef enum { typedef enum {
UIDeviceFirmware2, UIDeviceFirmware2,
UIDeviceFirmware3, UIDeviceFirmware3,
UIDeviceFirmware4,
} UIDeviceFirmware; } UIDeviceFirmware;


enum { enum {
Expand Down Expand Up @@ -81,6 +85,7 @@ enum {
UIDeviceSupportsNike = 1 << 25, UIDeviceSupportsNike = 1 << 25,
UIDeviceSupportsPiezoClicker = 1 << 26, UIDeviceSupportsPiezoClicker = 1 << 26,
UIDeviceSupportsVolumeButtons = 1 << 27, UIDeviceSupportsVolumeButtons = 1 << 27,
UIDeviceSupportsEnhancedMultitouch = 1 << 28, // http://www.boygeniusreport.com/2010/01/13/apples-tablet-is-an-iphone-on-steroids/
}; };


/* /*
Expand Down
45 changes: 44 additions & 1 deletion UIDevice-Hardware.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ @implementation UIDevice (Hardware)
iPod3,1 -> iPod touch 3G iPod3,1 -> iPod touch 3G
i386 -> iPhone Simulator i386 -> iPhone Simulator
Tablet1,1 -> Tablet 1G
*/ */




Expand Down Expand Up @@ -122,6 +124,8 @@ - (NSUInteger) platformType
if ([platform isEqualToString:@"iPod3,1"]) return UIDevice3GiPod; if ([platform isEqualToString:@"iPod3,1"]) return UIDevice3GiPod;
if ([platform isEqualToString:@"iPod4,1"]) return UIDevice4GiPod; if ([platform isEqualToString:@"iPod4,1"]) return UIDevice4GiPod;


// if ([platform isEqualToString:@"Tablet1,1"]) return UIDevice1GTablet; // space holder

if ([platform hasPrefix:@"iPhone"]) return UIDeviceUnknowniPhone; if ([platform hasPrefix:@"iPhone"]) return UIDeviceUnknowniPhone;
if ([platform hasPrefix:@"iPod"]) return UIDeviceUnknowniPod; if ([platform hasPrefix:@"iPod"]) return UIDeviceUnknowniPod;


Expand All @@ -145,12 +149,14 @@ - (NSString *) platformString
case UIDevice4GiPod: return IPOD_4G_NAMESTRING; case UIDevice4GiPod: return IPOD_4G_NAMESTRING;
case UIDeviceUnknowniPod: return IPOD_UNKNOWN_NAMESTRING; case UIDeviceUnknowniPod: return IPOD_UNKNOWN_NAMESTRING;


case UIDevice1GTablet : return TABLET_1G_NAMESTRING;

case UIDeviceiPhoneSimulator: return IPHONE_SIMULATOR_NAMESTRING; case UIDeviceiPhoneSimulator: return IPHONE_SIMULATOR_NAMESTRING;


case UIDeviceiProd1G: return IPROD_1G_NAMESTRING; case UIDeviceiProd1G: return IPROD_1G_NAMESTRING;
case UIDeviceiProd2G: return IPROD_2G_NAMESTRING; case UIDeviceiProd2G: return IPROD_2G_NAMESTRING;
case UIDeviceIFPGA: return IFPGA_NAMESTRING; case UIDeviceIFPGA: return IFPGA_NAMESTRING;

default: return IPOD_FAMILY_UNKNOWN_DEVICE; default: return IPOD_FAMILY_UNKNOWN_DEVICE;
} }
} }
Expand Down Expand Up @@ -354,6 +360,39 @@ - (NSUInteger) platformCapabilities
); );
case UIDeviceUnknowniPod: return 0; case UIDeviceUnknowniPod: return 0;


case UIDevice1GiPod:
return
(// UIDeviceSupportsTelephony |
// UIDeviceSupportsSMS |
// UIDeviceSupportsStillCamera |
// UIDeviceSupportsAutofocusCamera |
// UIDeviceSupportsVideoCamera |
UIDeviceSupportsWifi |
UIDeviceSupportsAccelerometer |
UIDeviceSupportsLocationServices |
// UIDeviceSupportsGPS |
// UIDeviceSupportsMagnetometer |
UIDeviceSupportsBuiltInMicrophone |
UIDeviceSupportsExternalMicrophone |
UIDeviceSupportsOPENGLES1_1 |
UIDeviceSupportsOPENGLES2 |
UIDeviceSupportsBuiltInSpeaker |
// UIDeviceSupportsVibration |
// UIDeviceSupportsBuiltInProximitySensor |
UIDeviceSupportsAccessibility |
UIDeviceSupportsVoiceOver |
UIDeviceSupportsVoiceControl |
UIDeviceSupportsPeerToPeer |
UIDeviceSupportsARMV7 |
UIDeviceSupportsBrightnessSensor |
UIDeviceSupportsEncodeAAC |
UIDeviceSupportsBluetooth |
UIDeviceSupportsNike |
// UIDeviceSupportsPiezoClicker |
UIDeviceSupportsVolumeButtons |
UIDeviceSupportsEnhancedMultitouch
);

case UIDeviceiPhoneSimulator: case UIDeviceiPhoneSimulator:
return return
(// UIDeviceSupportsTelephony | (// UIDeviceSupportsTelephony |
Expand Down Expand Up @@ -428,6 +467,8 @@ - (NSArray *) capabilityArray
if (flags & UIDeviceSupportsPiezoClicker) [array addObject:@"Piezo clicker"]; if (flags & UIDeviceSupportsPiezoClicker) [array addObject:@"Piezo clicker"];
if (flags & UIDeviceSupportsVolumeButtons) [array addObject:@"Physical volume rocker"]; if (flags & UIDeviceSupportsVolumeButtons) [array addObject:@"Physical volume rocker"];


if (flags & UIDeviceSupportsEnhancedMultitouch) [array addObject:@"Enhanced Multitouch"];

return array; return array;
} }


Expand Down Expand Up @@ -492,6 +533,8 @@ - (NSString *) platformCode
case UIDevice3GiPod: return @"N18"; case UIDevice3GiPod: return @"N18";
case UIDeviceUnknowniPod: return IPOD_UNKNOWN_NAMESTRING; case UIDeviceUnknowniPod: return IPOD_UNKNOWN_NAMESTRING;


case UIDevice1GTablet: return @"K48AP"; // http://www.boygeniusreport.com/2010/01/13/apples-tablet-is-an-iphone-on-steroids/

case UIDeviceiPhoneSimulator: return IPHONE_SIMULATOR_NAMESTRING; case UIDeviceiPhoneSimulator: return IPHONE_SIMULATOR_NAMESTRING;


default: return IPOD_FAMILY_UNKNOWN_DEVICE; default: return IPOD_FAMILY_UNKNOWN_DEVICE;
Expand Down

0 comments on commit 0a970a5

Please sign in to comment.