Skip to content

Commit

Permalink
Added ble manager
Browse files Browse the repository at this point in the history
Added geolocation
Added Wearable registration
Posted pms data to API flask server
  • Loading branch information
QuangNguyen1412 committed Jan 31, 2020
1 parent 0852d2f commit 0c148da
Show file tree
Hide file tree
Showing 7 changed files with 598 additions and 165 deletions.
5 changes: 4 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE"/>

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
Expand Down
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@
"bundle-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output .\\android\\app\\src\\main\\assets\\index.android.bundle --assets-dest .\\android\\app\\src\\main\res\\"
},
"dependencies": {
"@react-native-community/geolocation": "^2.0.2",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-native": "^3.6.0",
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-ble-manager": "^7.1.1",
"react-native-camera": "git+https://[email protected]/react-native-community/react-native-camera.git",
"react-native-firebase": "^5.5.6",
"react-native-gesture-handler": "^1.5.0",
"react-native-permissions": "^2.0.3",
"react-native-qrcode-scanner": "^1.3.1",
"react-native-reanimated": "^1.4.0",
"react-native-screens": "1.0.0-alpha.23",
"react-native-simple-radio-button": "^2.7.4",
"react-native-spinkit": "^1.5.0",
"react-native-wifi-reborn": "^2.2.0",
"react-navigation": "^4.0.10",
Expand Down
1 change: 1 addition & 0 deletions src/components/Constants/globalConstants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default class GlobalConstants {
static SERVER_DOMAIN_NAME = 'https://scottgale.appspot.com/';
static SAVE_WEAR_DATA = 'save_wear_data';
}
31 changes: 20 additions & 11 deletions src/components/screens/Home/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ import Loader from '../../components/Loader';
import ConfigurationScreen from './ConfigurationScreen/ConfigurationScreen';
import SensorsView from './SensorsView/SensorsView';
import InputField from '../../components/InputField';
import RadioForm, {
RadioButton,
RadioButtonInput,
RadioButtonLabel,
} from 'react-native-simple-radio-button';
import RadioForm from 'react-native-simple-radio-button';
import Geolocation from '@react-native-community/geolocation';

const homebgPath = require('../../../../assets/home_bg.png');
const configureIconPath = require('../../../../assets/configure_icon.png');
Expand Down Expand Up @@ -154,9 +151,12 @@ export default class HomeScreen extends React.Component {
// Connect to Soft Access Point on Device
this.connectToAirUSoftAP(softAPssid);
};

componentDidMount = async () => {
console.log('HomeScreen mounted ' + global.email);
// var dates = Date.now();
// console.log(dates);
// await this.findCoordinates('TESTING');
// console.log('After finding');
// await addDeviceInfoToFireBaseDataBase('aa:bB:cc:dd', 'example label');
};

Expand Down Expand Up @@ -243,15 +243,24 @@ export default class HomeScreen extends React.Component {
};

onSubmittingDeviceLabel = () => {
// this.label = text;
if (this.label.length === 0) {
Alert.alert('Please give your AirU a name!');
return;
}
this.setState({
cameraScan: true,
isEnteringDeviceLabel: false,
});
// skip the camera scan when it is wearable device
if (this.state.isWearable) {
this.setState({
cameraScan: false,
registeringDevice: true,
isLoading: false,
isEnteringDeviceLabel: false,
});
} else {
this.setState({
cameraScan: true,
isEnteringDeviceLabel: false,
});
}
};

labelInputHandler = text => {
Expand Down
Loading

0 comments on commit 0c148da

Please sign in to comment.