M7副處理器擷取動作資料,m7處理器擷取
NSObject
NSObject大多數objective - c類階層的根類。
CMAltimeter
使用CMAltimeter對象啟動altitude-related資料應用程式的交付。
CMAttitude
CMAttitude類的一個執行個體代表了測量裝置的態度在一個時間點。
CMLogItem
CMLogItem類是基類的核心運動類,處理特定類型的運動事件。
CMAccelerometerData
CMAccelerometerData類的一個執行個體代表一個加速度計的事件。
CMAltitudeData
CMAltitudeData對象封裝資訊相對高度的變化。
CMDeviceMotion
CMDeviceMotion的執行個體封裝態度的測量,轉速,加速裝置。
CMGyroData
CMGyroData類的一個執行個體包含一個測量裝置的旋轉速度。
CMMagnetometerData
CMMagnetometerData類的執行個體封裝的磁場測量裝置的磁強計。
CMMotionActivity
CMMotionActivity類包含一個運動的資料更新事件。
CMMotionActivityManager
運動CMMotionActivityManager類提供了訪問資料存放區裝置。
CMMotionManager
CMMotionManager對象是通往運動iOS提供的服務。
CMPedometer
使用CMPedometer對象擷取pedestrian-related資料。
CMPedometerData
CMPedometerData對象封裝資訊使用者步行的距離。
CMStepCounter
CMStepCounter類提供了訪問使用者已經採取措施的數量和裝置。
CMStepCounter類提供了訪問使用者已經採取措施的數量和裝置。資訊收集與適當的內建的硬體和存放裝置上,這樣您就可以執行查詢來確定使用者的最近的身體活動。你用這個類來收集當前步驟資料和曆史資料。(將在8.0之後有所更改,升級時要注意)
使用CMPedometer對象擷取pedestrian-related資料。你使用一個計步器對象檢索步驟數和其他資訊距離和地板的數量提升或下降。計步器對象管理緩衝的曆史資料可以查詢或要求即時更新的資料處理。使用一個計步器對象,建立這個類的一個執行個體並調用適當的方法。使用queryPedometerDataFromDate:迄今為止:withHandler:方法來檢索資料,已經聚集。即時更新,使用startPedometerUpdatesFromDate:withHandler:方法開始事件處理常式提供的交付。(8.0開始支援)
CMPedometerData對象封裝資訊使用者步行的距離。你不自己建立這個類的執行個體。相反,您使用CMPedometer對象請求計步器的資料系統。為每個請求的資料打包成這個類的一個執行個體並交付給你註冊的處理常式計步器對象。(8.0開始支援)
/* * CMStepCounter * * Discussion: * CMStepCounter allows access to the approximate number of steps a user has taken * with a device. Steps can be retrieved in one of two ways: * * 1. Via a query specifying a time range from which the approximate number of steps is * tabulated and returned. (See queryStepCountStartingFrom:to:toQueue:withHandler) * * 2. By providing a queue and a block to startStepCountingUpdatesToQueue:withHandler, * step count updates will be provided on a best effort basis. Each update will return a * monotonically increasing number of steps counted since * startStepCountingUpdatesToQueue:withHandler was called and a timestamp * associated with the latest stepcount determination. Step count updates can be stopped * by either calling stopStepCountingUpdates or upon CMStepCounter deallocation. * */NS_CLASS_AVAILABLE(NA,7_0)@interface CMStepCounter : NSObject/* * isStepCountingAvailable * * Discussion: * Determines whether the device supports step counting. */+ (BOOL)isStepCountingAvailable;/* * queryStepCountStartingFrom:to:toQueue:withHandler * * Discussion: * Queries for the approximate number of steps taken in the given time range, for up to 7 days. * The step count returned is computed from a system wide history that is continuously being * collected in the background. The result is returned to the handler/queue specified. */- (void)queryStepCountStartingFrom:(NSDate *)start to:(NSDate *)end toQueue:(NSOperationQueue *)queue withHandler:(CMStepQueryHandler)handler;/* * startStepCountingUpdatesToQueue:withHandler * * Discussion: * Starts a series of continuous step counting updates to the handler on the designated queue. For each * update, the app will receive the total step count since this method was called (this includes * subsequent calls) and the timestamp associated with the latest determination. If the app is backgrounded * and resumed at a later time, the app will receive all of the steps counted during the background * period in the very next update. The handler will be called when the number of steps (as defined by * the user) has been detected on a best effort basis. */- (void)startStepCountingUpdatesToQueue:(NSOperationQueue *)queue updateOn:(NSInteger)stepCounts withHandler:(CMStepUpdateHandler)handler;/* * stopStepCountingUpdates * * Discussion: * Stops step counting updates. Upon deallocation of CMStepCounter, this function will be * automatically invoked if updates are still active and stopStepCountingUpdates has not been * called. */- (void)stopStepCountingUpdates;@end
以下是代碼的應用
UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 568/2)]; [label setBackgroundColor:[UIColor grayColor]]; label.textColor =[UIColor redColor]; label.textAlignment = NSTextAlignmentCenter; [self.view addSubview:label]; if ([CMStepCounter isStepCountingAvailable]) { NSLog(@"isStepCountingAvailable!!!"); NSOperationQueue *queueStep = [[NSOperationQueue alloc] init] ; //20步數,更新一次 [_cmStepCounter startStepCountingUpdatesToQueue:queueStep updateOn:20 withHandler:^(NSInteger numberOfSteps, NSDate *timestamp, NSError *error) { NSLog(@"numberOfSteps==%ld,timestamp==%@",(long)numberOfSteps,timestamp); _steps = numberOfSteps; label.text = [NSString stringWithFormat:@"%ld",_steps]; }]; }else{ NSLog(@"isNOT StepCountingAvailable"); }
iPhone5S的M7副處理器是何物,將怎工作?
無論你在走路,跑步,甚至開車,M7 副處理器通通知曉。由於 M7 副處理器知道你何時身處行駛的車輛中,因此 iPhone 5s 不會詢問你是否要加入路過的無線網路。如果你的手機許久未動,例如當你睡覺時,M7 副處理器會減少網路檢測,從而節省電池電量。 在晶片領域,如何延長手機的續航能力,永遠是一個很矛盾的問題,增加的電池容量永遠與逐步擴大的螢幕尺寸作鬥爭,這問題可以說是無解。而晶片廠商所能夠做的就只有增強內部的控制。晶片業老大高通的產品總監就表示:手機的功耗最佳化是無止境的,有時候你並不能確定是否該進行減少,因為你不知道手機正在做些什麼,但是加入感應器後,手機將會變得更加智能,開始能夠瞭解使用者的行為,並且做出更加細緻的調整。 而最新發行的iPhone5S中搭載的M7副處理器,就是這麼一個感應器資料處理中心。在蘋果官方的描述中,M7 用來“持續地測量動作資料”,包括來自加速計、陀螺儀、指南針的資料。我預計將來光線感應器、距離感應器、重力感應器的資料都會交由 M7 副處理器來處理。 iPhone 5s 除了配備副處理器 M7 外,也提供了叫“CoreMotion”的 API 介面,供第三方調用 M7 副處理器。發布會 Demo 的例子是 Nike 新的運動 App“Nike+ Move”調用了 M7 副處理器和 GPS 晶片,來跟蹤使用者一天的行為。Nike 的 App 調用了 GPS 給 M7 處理(通過 API 接入副處理器),可以節省使用者的電量。
M7副處理器是會是蘋果地圖逆襲的開始?
雖然很多人都覺得前幾日的蘋果新品發布會乏善可陳,但是在一片惡搞之外,也應該看到一些能夠稱之為亮點的東西,M7副處理器就是其中之一。副處理器這種概念不是第一次出現,前不久發布的Moto X中的X8計算系統在節能和持續感知上有些類似。而三星Galaxy S4和Note 2,以及魅族MX 3也有類似的Sensor Hub技術。
再複述一下M7的功能作用:
無論你在走路,跑步,甚至開車,M7副處理器通通知曉。由於M7副處理器知道你何時身處行駛的車輛中,因此 iPhone 5S不會詢問你是否要加入路過的無線網路。如果你的手機許久未動,例如當你睡覺時,M7副處理器會減少網路檢測,從而節省電池電量。
Google地圖的強勢一直讓蘋果地圖抬不起頭來,即使蘋果把它放在App Store顯眼的位置。根據9to5Mac的報道,在蘋果地圖更新後,地圖應用可以運用M7副處理器來協助使用者找到自己的車。M7副處理器可以感應到使用者合適停止開車並讓手機記錄車輛位置,當使用者再次需要用車的時候,就可以藉助M7和蘋果地圖的協作很容易地找到自己的車了。
這隻是一個應用情境,據稱蘋果還在致力於研發其他的地圖特性,比如室內地圖和公用交通領域。直接證據就是蘋果最近收購了相關的兩家公司WifiSLAM和Hopstop,先前也收購了幾家專註於交通運輸的公司。在新蘋果地圖中插入新資料應該是跑不了的。
除此之外,蘋果還有其他的一些新特性也可以用在蘋果地圖上,比如發布會上相對低調運用了低功耗的藍芽技術的iBeacons。雖然具體技術細節還不甚明了,但從目前已知的資訊來看,iBeacons可以提供室內地圖等微區位服務,為特定地區內任意相關裝置提供優惠資訊、硬解碼定位等服務。