You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/05/19 00:15:32 UTC

[1/3] ios commit: [CB-464] rewrite of accel plugin. not working yet.

Updated Branches:
  refs/heads/master da548399e -> 02d212ab4


[CB-464] rewrite of accel plugin. not working yet.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/d888bf39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/d888bf39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/d888bf39

Branch: refs/heads/master
Commit: d888bf3997ef0986af7228d08079ad3ef76d1453
Parents: da54839
Author: Fil Maj <ma...@gmail.com>
Authored: Tue May 15 16:43:58 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri May 18 15:18:20 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVAccelerometer.m |   31 +++++++++++++--------------
 1 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d888bf39/CordovaLib/Classes/CDVAccelerometer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVAccelerometer.m b/CordovaLib/Classes/CDVAccelerometer.m
index 8f8d95b..51c0ae4 100644
--- a/CordovaLib/Classes/CDVAccelerometer.m
+++ b/CordovaLib/Classes/CDVAccelerometer.m
@@ -48,9 +48,8 @@
         y = 0;
         z = 0;
         timestamp = 0;
-        self.accelCallbacks = nil;
-        self.watchCallbacks = nil;
-        self.isRunning = NO;
+        accelCallbacks = nil;
+        watchCallbacks = nil;
     }
     return self;
 }
@@ -66,13 +65,13 @@
 	UIAccelerometer* pAccel = [UIAccelerometer sharedAccelerometer];
 	// accelerometer expects fractional seconds, but we have msecs
 	pAccel.updateInterval = desiredFrequency_num / 1000;
-    if (!self.accelCallbacks) {
-        self.accelCallbacks = [NSMutableArray arrayWithCapacity:1];            
+    if (!accelCallbacks) {
+        accelCallbacks = [NSMutableArray arrayWithCapacity:1];            
     }
     if (!watchCallbacks) {
-        self.watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
+        watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
     }
-	if(!self.isRunning)
+	if(!_bIsRunning)
 	{
 		pAccel.delegate = self;
 		self.isRunning = YES;
@@ -97,10 +96,10 @@
     {
         CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];
         [result setKeepCallback:[NSNumber numberWithBool:YES]];
-        if (!self.accelCallbacks) {
-            self.accelCallbacks = [NSMutableArray arrayWithCapacity:1];            
+        if (!accelCallbacks) {
+            accelCallbacks = [NSMutableArray arrayWithCapacity:1];            
         }
-        [self.accelCallbacks addObject:callbackId];
+        [accelCallbacks addObject:callbackId];
         [self start];
         [self writeJavascript:[result toSuccessCallbackString:callbackId]];
     } else {
@@ -113,14 +112,14 @@
     NSString* callbackId = [arguments objectAtIndex:0];
     NSString* timerId = [arguments objectAtIndex:1];
     
-    if (!self.watchCallbacks) {
-        self.watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
+    if (!watchCallbacks) {
+        watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
     }
     
     // add the callbackId into the dictionary so we can call back whenever get data
-    [self.watchCallbacks setObject:callbackId forKey:timerId];
+    [watchCallbacks setObject:callbackId forKey:timerId];
     
-    if (!self.isRunning) {
+    if (!_bIsRunning) {
         [self start];
     }
     CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];
@@ -131,8 +130,8 @@
 {
     NSString* callbackId = [arguments objectAtIndex:0];
     NSString* timerId = [arguments objectAtIndex:1];
-    if (self.watchCallbacks && [self.watchCallbacks objectForKey:timerId]) {
-        [self.watchCallbacks removeObjectForKey:timerId];
+    if (watchCallbacks && [watchCallbacks objectForKey:timerId]) {
+        [watchCallbacks removeObjectForKey:timerId];
     }
     CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
     NSString* jsString = [result toSuccessCallbackString:callbackId];