iphone - Suggestions on program layout and storage of Cocoa program that analyzes -


short background: writing program in xcode mac, plan take parts of (conceptually, if not whole chunks of code) on iphone. involves receiving data through bluetooth external sensor (regardless of user interaction data must received). i've built simple program on mac using iobluetooth pairs , starts receiving data fine, , plan on using btstack , jailbroken iphone in order access bluetooth chip on iphone.

before far want conceptually lay program out correctly, because used procedural programming , obj-c new beast me. stated, able save of code possible when move iphone (i understand there different classes views etc, see -lots- of similarities).

1) program receiving data in background (regardless of user actions - ie, once user starts program , picks bt device, data flow) , need store , analyze data before can presented user. (the question), how 1 lay out? thinking of putting of bt code in appdelegate, , having view controller (on mac 1 handles window, on iphone tab controller multiple sub view controllers), , model analyzes , stores data (also log files, future reference) accessed "controller", in case appdelegate. layout make sense? kosher mvc/cocoa put of bt code , analysis in appdelegate, or should it(they) in own class(es) (knowing bt code on both mac , iphone must receive bursts of data)? how improved?

2) related question on analysis side. haven't found single cocoa example on net has analysis (i've found programs, no explanation of model use). basic data saved small ~50kb per hour. however, results (including spectrum , waterfall plots) >2mb per hour (this program 1 might run many hours day). analyze "on go" , throw results in scrolling buffer know fast, want program allow user @ specific time segments in past. question have should model object analyze data , store results alongside basic data, or should model store basic data, , return data controller analyze present view (this cpu heavy if regraphing minutes of data, let alone hours)?

any thoughts or suggestions appreciated, feel laying proper groundwork save me untold hours of coding (and fixed/debugging) later.

as question 1:

i suggest write class/object manages bluetooth data, separately app delegate. app delegate view objects meet controller, , such there lots of calls appkit (on os x) , uikit (on ios). change great #ifdef between oses inside same file won't make sense app delegate.

rather, make ivar holding bluetooth controller inside app delegate. way code better structured, , easier reused.

as question 2:

on os x machine, comes plenty of ram these days, holding , caching resulting data on ram fine, if it's 2mb per hour.

on ios machine, ram endangered resource. if program caches calculated data in memory , consumes lot of ram , user send background, os might outright kill program instead of suspending it, example. you'll need recalculate data anyway, because app re-launched. 

the filesystem capacity quite big on ios machine. 1 way out write out calculated data onto disk, , let view controller reload previous calculated data there. way, program can access pre-calculated data after it's relaunched.

that cacheing code can shared between os x , ios, if don't hard-code cache directory program.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -