Permalink
Browse files

System properties IOS update + sample Images

  • Loading branch information...
1 parent 59a3945 commit d3074540d5bc087ffe2e3ebbbc7266624874f083 @mateuszmackowiak committed Mar 6, 2012
Showing with 404 additions and 1 deletion.
  1. +101 −0 XCode/NativeAlert/NativeAlert.m
  2. BIN ...t.xcodeproj/project.xcworkspace/xcuserdata/mmmackowiak.xcuserdatad/UserInterfaceState.xcuserstate
  3. BIN build/NativeAlert.swc
  4. BIN build/libNativeAlert.a
  5. +3 −1 example/NativeAlertMobile/.actionScriptProperties
  6. +300 −0 example/NativeAlertMobile/bin-release-temp/NativeAlertMobile-app.xml
  7. BIN example/NativeAlertMobile/bin-release-temp/NativeAlertMobile.swf
  8. BIN images/AndoridToast
  9. BIN images/MultiChoiceNaitveDialogAndoridDefaultTheme
  10. BIN images/MultiChoiceNaitveDialogAndoridHaloDarkTheme
  11. BIN images/MultiChoiceNaitveDialogAndoridHaloLightTheme
  12. BIN images/NativeAlertAndroidHaloLightTheme.png
  13. BIN images/NativeAlertAndroidHaloTheme.png
  14. BIN images/NativeAlertWithoutMessageAndTitle.png
  15. BIN images/NativeProgressAndoridHorizontalDefaultTheme.PNG
  16. BIN images/NativeProgressAndoridHorizontalHaloDarkTheme.PNG
  17. BIN images/NativeProgressAndoridHorizontalIndeterminateDefaultTheme.PNG
  18. BIN images/NativeProgressAndoridHorizontalIndeterminateHaloDarkTheme.PNG
  19. BIN images/NativeProgressAndoridSpinnerDefaultTheme.PNG
  20. BIN images/NativeProgressAndoridSpinnerHaloLightTheme.PNG
  21. BIN images/NativeProgressIOSHorizontal.PNG
  22. BIN images/NativeProgressIOSSpinner.PNG
  23. BIN images/NativeTextInputAndroidDefaultLightTheme
  24. BIN images/NativeTextInputAndroidHaloDarkTheme
  25. BIN images/NativeTextInputAndroidHaloLightTheme
  26. BIN images/SingleChoiceAndoridDefaultTheme.png
  27. BIN images/SingleChoiceAndoridHaloDarkTheme.png
  28. BIN images/SingleChoiceAndoridHaloLightTheme.png
  29. BIN images/adobe-air-icon.png
@@ -9,6 +9,12 @@
#include "FlashRuntimeExtensions.h"
#import "MobileAlert.h"
#import "UIApplication+UIID.h"
+
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+
MobileAlert *alert;
@@ -191,6 +197,80 @@ FREObject isShowing(FREContext ctx, void* funcData, uint32_t argc, FREObject arg
//
//---------------------------------------------------------------------
+
+/**
+*John Muchow (http://iPhoneDeveloperTips.com/device/determine-mac-address.html)
+*/
+NSString * getMacAddress()
+{
+ int mgmtInfoBase[6];
+ char *msgBuffer = NULL;
+ size_t length;
+ unsigned char macAddress[6];
+ struct if_msghdr *interfaceMsgStruct;
+ struct sockaddr_dl *socketStruct;
+ NSString *errorFlag = NULL;
+
+ // Setup the management Information Base (mib)
+ mgmtInfoBase[0] = CTL_NET; // Request network subsystem
+ mgmtInfoBase[1] = AF_ROUTE; // Routing table info
+ mgmtInfoBase[2] = 0;
+ mgmtInfoBase[3] = AF_LINK; // Request link layer information
+ mgmtInfoBase[4] = NET_RT_IFLIST; // Request all configured interfaces
+
+ // With all configured interfaces requested, get handle index
+ if ((mgmtInfoBase[5] = if_nametoindex("en0")) == 0)
+ errorFlag = @"if_nametoindex failure";
+ else
+ {
+ // Get the size of the data available (store in len)
+ if (sysctl(mgmtInfoBase, 6, NULL, &length, NULL, 0) < 0)
+ errorFlag = @"sysctl mgmtInfoBase failure";
+ else
+ {
+ // Alloc memory based on above call
+ if ((msgBuffer = malloc(length)) == NULL)
+ errorFlag = @"buffer allocation failure";
+ else
+ {
+ // Get system information, store in buffer
+ if (sysctl(mgmtInfoBase, 6, msgBuffer, &length, NULL, 0) < 0)
+ errorFlag = @"sysctl msgBuffer failure";
+ }
+ }
+ }
+
+ // Befor going any further...
+ if (errorFlag != NULL)
+ {
+ NSLog(@"Error: %@", errorFlag);
+ return errorFlag;
+ }
+
+ // Map msgbuffer to interface message structure
+ interfaceMsgStruct = (struct if_msghdr *) msgBuffer;
+
+ // Map to link-level socket structure
+ socketStruct = (struct sockaddr_dl *) (interfaceMsgStruct + 1);
+
+ // Copy link layer address data in socket structure to an array
+ memcpy(&macAddress, socketStruct->sdl_data + socketStruct->sdl_nlen, 6);
+
+ // Read from char array into a string object, into traditional Mac address format
+ NSString *macAddressString = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X",
+ macAddress[0], macAddress[1], macAddress[2],
+ macAddress[3], macAddress[4], macAddress[5]];
+ NSLog(@"Mac Address: %@", macAddressString);
+
+ // Release the buffer memory
+ free(msgBuffer);
+
+ return macAddressString;
+}
+
+//[[UIApplication sharedApplication] setApplicationIconBadgeNumber:99];
+
+
FREObject getSystemProperties(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[] ){
FREObject dic;
@@ -202,26 +282,44 @@ FREObject getSystemProperties(FREContext ctx, void* funcData, uint32_t argc, FRE
const char *udidCh = [[device uniqueIdentifier] UTF8String];
const char *uidCh = "";//[[[UIApplication sharedApplication] uniqueInstallationIdentifier] UTF8String];
const char *nameCh = [[device name] UTF8String];
+ const char *MACadress = [getMacAddress() UTF8String];
+ const char *localizedModel = [[device localizedModel] UTF8String];
+ const char *model = [[device model] UTF8String];
// float batLevel = [device batteryLevel];
+
+
+
FREObject uidObj;
FREObject udidObj;
FREObject osObj;
FREObject versionObj;
FREObject nameObj;
+ FREObject MACadressObj;
+ FREObject localizedModelObj;
+ FREObject modelObj;
+
+
FRENewObjectFromUTF8(strlen(udidCh)+1, (const uint8_t*)udidCh, &udidObj);
FRENewObjectFromUTF8(strlen(uidCh)+1, (const uint8_t*)uidCh, &uidObj);
FRENewObjectFromUTF8(strlen(osCh)+1, (const uint8_t*)osCh, &osObj);
FRENewObjectFromUTF8(strlen(versionCh)+1, (const uint8_t*)versionCh, &versionObj);
FRENewObjectFromUTF8(strlen(nameCh)+1, (const uint8_t*)nameCh, &nameObj);
+
+ FRENewObjectFromUTF8(strlen(MACadress)+1, (const uint8_t*)MACadress, &MACadressObj);
+ FRENewObjectFromUTF8(strlen(localizedModel)+1, (const uint8_t*)localizedModel, &localizedModelObj);
+ FRENewObjectFromUTF8(strlen(model)+1, (const uint8_t*)model, &modelObj);
FRESetObjectProperty(dic, (const uint8_t*)"UID", uidObj, NULL);
FRESetObjectProperty(dic, (const uint8_t*)"UDID", udidObj, NULL);
FRESetObjectProperty(dic, (const uint8_t*)"os", osObj, NULL);
FRESetObjectProperty(dic, (const uint8_t*)"version", versionObj, NULL);
FRESetObjectProperty(dic, (const uint8_t*)"name", nameObj, NULL);
+ FRESetObjectProperty(dic, (const uint8_t*)"MACAdress", MACadressObj, NULL);
+ FRESetObjectProperty(dic, (const uint8_t*)"localizedModel", localizedModelObj, NULL);
+ FRESetObjectProperty(dic, (const uint8_t*)"model", modelObj, NULL);
return dic;
}else{
return nil;
@@ -231,6 +329,9 @@ FREObject getSystemProperties(FREContext ctx, void* funcData, uint32_t argc, FRE
+
+
+
//------------------------------------
//
// Required Methods.
View
Binary file not shown.
View
Binary file not shown.
@@ -69,7 +69,9 @@
<buildTarget airDownloadURL="https://market.android.com/details?id=com.adobe.air" androidSettingsVersion="1" buildTargetName="com.adobe.flexide.multiplatform.android.platform">
<airSettings airCertificatePath="/Users/mmmackowiak/Documents/Adobe Flash Builder 4.6/CERTYFIKATY/android.p12" airTimestamp="true" anePathSet="true" version="1">
<airExcludes/>
- <anePaths/>
+ <anePaths>
+ <anePathEntry path="/Users/mmmackowiak/Documents/git/NativeDialog/build/release/NativeAlert.ane"/>
+ </anePaths>
</airSettings>
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" version="2"/>
<actionScriptSettings version="1"/>
Oops, something went wrong. Retry.

0 comments on commit d307454

Please sign in to comment.