Skip to content

Commit

Permalink
"Made changes in README.MD and added copyright license"
Browse files Browse the repository at this point in the history
  • Loading branch information
amal2000-cse committed Jun 29, 2022
1 parent d6b435b commit 099e405
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 46 deletions.
106 changes: 88 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,106 @@
# Smart Watch 3
## Library Name:
Smart Watch 3

一UI design for Smart Watch in OpenHarmony.
## Library Version:
1.0.0

## Compatibility
Supports OpenHarmony API version 8

## Smart Watch 3 Design :
## Library Overview:
Smart Watch three shows following functionalites;
- It fetches weather details based on the location of the user.
- Shows current date and time
- Calculates Number of steps walked and Calories burned .

<hr>

### GitHub link: [Smart Watch three](https://github.com/Applib-OpenHarmony/SmartWatchThree)
<hr>


## Compatibility
Supports OpenHarmony API version 6

## Screenshot of the Library:

## Open source License



# Library Feature1:
### Description:
It fetches weather details from the API's
### Code Snippet:
```
fetchWeather: function () {
var dataw = JSON.stringify(item);
let weather_api_input = JSON.parse(dataw);
let data;
fetch.fetch({
url: "https://api.openweathermap.org/data/2.5/weather?lat=" + weather_api_input[0].latitude + "&lon=" + weather_api_input[0].longitude + "&appid=" + weather_api_input[0].api_key,
responseType: "json",
method: 'GET',
success: function (resp) {
data = JSON.stringify(resp);
console.info('Weather data fetch success. Resp: ' + data);
},
fail: function (data, code) {
console.log("fail data: " + JSON.stringify(data) + " fail code: " + code);
},
complete: () => {
const { main } = data.weather[0];
this.weather = main;
this.weather_description = main;
}
})
},
fetchNotification: function () {
let data;
fetch.fetch({
complete: () => {
this.notification = data.notification;
this.min_progress_calories = data.min_progress_calories;
this.min_progress_footSteps = data.min_progress_footSteps;
}
})
}
```

### Screenshot:

Copyright (C) 2020-21 Application Library Engineering Group

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
### Flow chart description:
In fetchWeather function it will first fetches the locations details of the user i.e latitude and longitude,
using openweather api fetches the weather details based on the latitude and longitude.

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
### Screenshot:


# Library Feature2:
### Description:
Calculates number of steps walked.

### Code Snippet:
```
function subscribePedometerSensor(context) {
sensor.subscribeStepCounter({
success: function (ret) {
context.mySteps = ret.steps.toString()
},
fail: function (data, code) {
console.log('Subscription failed. Code: ' + code + '; Data: ' + data)
}
})
}
```
### Screenshot:



## Advanced feature that could be implemented in Future in this library:
Calculating Blood Pressure and Calories Burned using respective API’s.


# Reference:
## Conclusion:
smart watch three calculates Number of steps walked, Calories burned, fetches date and time and weather details based on location and notifications.

Design by : Dharma Seelan
27 changes: 13 additions & 14 deletions entry/src/main/js/MainAbility/app.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright (C) 2020-21 Application Library Engineering Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2022 Application Library Engineering Group.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info("Application onCreate");
Expand Down
27 changes: 13 additions & 14 deletions entry/src/main/js/MainAbility/pages/index/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright (C) 2020-21 Application Library Engineering Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2022 Application Library Engineering Group.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// @ts-nocheck
import ability_featureAbility from '@ohos.ability.featureAbility'
Expand Down

0 comments on commit 099e405

Please sign in to comment.