-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Made changes in README.MD and added copyright license"
- Loading branch information
1 parent
d6b435b
commit 099e405
Showing
3 changed files
with
114 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters