Skip to content

Commit

Permalink
First commit of iOS APP . It has two types of charts - All sensors an…
Browse files Browse the repository at this point in the history
…d combined one.
  • Loading branch information
atulveer committed May 19, 2016
0 parents commit 1b39b7e
Show file tree
Hide file tree
Showing 487 changed files with 116,092 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[ignore]

# We fork some components by platform.
.*/*.web.js
.*/*.android.js

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*

# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/fetch.js
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
.*/node_modules/fbjs/lib/ErrorUtils.js

# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js

.*/__mocks__/.*
.*/__tests__/.*

.*/commoner/test/source/widget/share.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*

# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js

# Ignore jest
.*/node_modules/jest-cli/.*

# Ignore Website
.*/website/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js

[options]
module.system=haste

esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

[version]
0.21.0
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.idea
.gradle
local.properties

# node.js
#
node_modules/
npm-debug.log
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
225 changes: 225 additions & 0 deletions App/Components/AllSensorsChart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@

var React = require('react-native');
var { LineChart } = require('react-native-ios-charts');


var {

View,
StyleSheet,
NativeAppEventEmitter
} = React;



// Demand in the auto-generated JavaScript class for our ObjC class
var {

Utility
} = require('NativeModules');



function sleepFor( sleepDuration ){
var now = new Date().getTime();
while(new Date().getTime() < now + sleepDuration){ /* do nothing */ }
}


var AllSensorsChart = React.createClass({


// Function to load live data from BLE

realTimeBreathReading: function(){


// Event Listener receving live breath data

subscription = NativeAppEventEmitter.addListener(
'getLiveBreathReadings',
(liveReading) => {

leftTopData = this.state.leftTop
centerTopData = this.state.centerTop
rightTopData = this.state.rightTop
leftBottomData = this.state.leftBottom
leftMiddleData = this.state.leftMiddle
rightMiddleData = this.state.rightMiddle
rightBottomData = this.state.rightBottom

labelsData = this.state.labelsData

leftTopData.push(parseInt(liveReading.leftTop))
centerTopData.push(parseInt(liveReading.centerTop))
rightTopData.push(parseInt(liveReading.rightTop))
leftBottomData.push(parseInt(liveReading.leftBottom))
leftMiddleData.push(parseInt(liveReading.leftMiddle))
rightMiddleData.push(parseInt(liveReading.rightMiddle))
rightBottomData.push(parseInt(liveReading.rightBottom))

labelsData.push("i")

sleepFor(2500)

this.setState({
leftTop: leftTopData ,
centerTop: centerTopData,
rightTop: rightTopData,
leftBottom: leftBottomData,
leftMiddle: leftMiddleData,
rightMiddle: rightMiddleData,
rightBottomD: rightBottomData,
labelsData: labelsData
})

})


},

getInitialState: function () {

return{
leftTop: [30],
centerTop: [32],
rightTop: [34],
leftBottom: [31],
leftMiddle: [33],
rightMiddle: [35],
rightBottom: [36],
labelsData: ["i"]
};



},

componentDidMount: function() {
this.realTimeBreathReading();
},

componentWillUnmount: function(){
subscription.remove();
},

render() {
const config = {
dataSets: [{
values: this.state.leftTop,
drawValues: true,
colors: ['rgb(76, 0, 153)'],
label: 'Left Top',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}, {
values: this.state.centerTop,
drawValues: true,
colors: ['rgb(75,0,130)'],
label: 'Center',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}

, {
values: this.state.rightTop,
drawValues: true,
colors: ['rgb(0,0,255)'],
label: 'Right Top',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}, {
values: this.state.leftBottom,
drawValues: true,
colors: ['rgb(0,128,0)'],
label: 'Left Bottom',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}, {
values: this.state.leftMiddle,
drawValues: true,
colors: ['rgb(255,255,0)'],
label: 'Left Middle',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}, {
values: this.state.rightMiddle,
drawValues: true,
colors: ['rgb(255,165,0)'],
label: 'Right Middle',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}, {
values: this.state.rightBottom,
drawValues: true,
colors: ['rgb(255,0,0)'],
label: 'Right Bottom',
drawCubic: true,
drawCircles: false,
lineWidth: 2
}],
backgroundColor: 'transparent',
labels: this.state.labelsData,
// minOffset: 20,
setDescription: "Chart shows Temperature of Exaled air.",
setTouchEnabled: true,
setScaleEnabled: true,
setPinchZoom: true,
setGranularityEnabled: true,
setGranularity: 10.0,
legend: {
textSize: 12,
setWordWrapEnabled: true
},
xAxis: {
axisLineWidth: 0,
drawLabels: false,
position: 'bottom',
drawGridLines: false
},
leftAxis: {
labelCount: 11,
drawGridLines: true,
setAxisMinValue: 30,
setAxisMaxValue: 50,
setSpaceTop: 5,
setPosition: "OUTSIDE_CHART"
},
rightAxis: {
enabled: false,
drawGridLines: false
},
valueFormatter: {
minimumSignificantDigits: 1,
type: 'regular',
maximumDecimalPlaces: 1
}
};

return (

<View style={styles.container}>
<LineChart config={config} style={styles.chart}/>
</View>
);
}
});




var styles = StyleSheet.create({
chart: {
width: 400,
height: 400,
padding: 10
}
})

module.exports = AllSensorsChart;
26 changes: 26 additions & 0 deletions App/Components/BarChar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Bar chart
var BreathChart = React.createClass({
render: function() {
return (
<View style={styles.container}>
<BarChart
config={{
dataSets: [{
values: [1, 2, 3, 10],
colors: ['green'],
label: '2015',
}, {
values: [3, 2, 1, 5],
colors: ['red'],
label: '2014',
}],
labels: ['a', 'b', 'c', 'd'],
}}
style={styles.chart}
/>
</View>
);
}
});
*/
Loading

0 comments on commit 1b39b7e

Please sign in to comment.