Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
huaweiWatchClient
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sky
huaweiWatchClient
Commits
7ffe7ac4
Commit
7ffe7ac4
authored
Apr 01, 2021
by
Sky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~
parent
93ab5b42
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1430 additions
and
52 deletions
+1430
-52
build.gradle
build.gradle
+2
-2
com.company.fit.otherDebug.p7b
com.company.fit.otherDebug.p7b
+0
-0
build.gradle
entry/build.gradle
+4
-3
config.json
entry/src/main/config.json
+5
-4
wearengine.js
entry/src/main/js/default/liteWearable/wearengine.js
+328
-0
end.js
entry/src/main/js/default/pages/end/end.js
+20
-7
index.js
entry/src/main/js/default/pages/index/index.js
+70
-35
wearengine.js
entry/src/main/js/default/wearable/wearengine.js
+1000
-0
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+1
-1
yucong0322.p7b
yucong0322.p7b
+0
-0
No files found.
build.gradle
View file @
7ffe7ac4
...
...
@@ -13,7 +13,7 @@ ohos {
signAlg
'SHA256withECDSA'
}
}
compileSdkVersion
3
compileSdkVersion
4
defaultConfig
{
compatibleSdkVersion
3
}
...
...
@@ -30,7 +30,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.huawei.ohos:hap:2.
0.0.6
'
classpath
'com.huawei.ohos:hap:2.
4.1.4
'
}
}
...
...
com.company.fit.other
_provision
Debug.p7b
→
com.company.fit.otherDebug.p7b
View file @
7ffe7ac4
No preview for this file type
entry/build.gradle
View file @
7ffe7ac4
...
...
@@ -6,9 +6,9 @@ ohos {
certpath
file
(
'D:/HuaweiWatchClient/com.company.fit.overseas_debug.cer'
)
profile
file
(
'D:/HuaweiWatchClient/com.company.fit.proDebug.p7b'
)
signAlg
'SHA256withECDSA'
keyPassword
'0000001B
9E576AD11A22A05641A642CA17ED844BB71D8027C1ACF79F928F7C1EA950008D8C70ADDF7E8429
'
keyPassword
'0000001B
17F8F53E0CF14D52675968C4FD60AA48E6580B4EEEE4AE8348FA556850E01CC92EEA6DE834CA36
'
keyAlias
'huawei_watch_overseas Release'
storePassword
'0000001B
3F89F001102D6FF1A0BB38E371027272283910D107D7F11A763F26295938F1A4E704A7F054C552
'
storePassword
'0000001B
16A4C8B18003852BF6E890B38F6D624C8314D7E55CE2FD87CBC3F2C9E2DA9403C977F0C988ABAE
'
storeFile
file
(
'D:/HuaweiWatchClient/huawei_watch_overseas.p12'
)
}
release
{
...
...
@@ -21,7 +21,8 @@ ohos {
certpath
file
(
'D:/HuaweiWatchClient/com.company.fit.overseas_release.cer'
)
}
}
compileSdkVersion
3
mergeJsSrc
true
compileSdkVersion
4
defaultConfig
{
compatibleSdkVersion
3
}
...
...
entry/src/main/config.json
View file @
7ffe7ac4
...
...
@@ -2,18 +2,19 @@
"app"
:
{
"bundleName"
:
"com.company.fit"
,
"version"
:
{
"code"
:
15
,
"name"
:
"1.0.
1
"
"code"
:
20
,
"name"
:
"1.0.
2
"
},
"apiVersion"
:
{
"compatible"
:
3
,
"target"
:
3
"target"
:
4
}
},
"deviceConfig"
:
{},
"module"
:
{
"deviceType"
:
[
"liteWearable"
"liteWearable"
,
"wearable"
],
"abilities"
:
[
{
...
...
entry/src/main/js/default/liteWearable/wearengine.js
0 → 100644
View file @
7ffe7ac4
This diff is collapsed.
Click to expand it.
entry/src/main/js/default/pages/end/end.js
View file @
7ffe7ac4
import
brightness
from
'@system.brightness'
//保持屏幕常亮
import
app
from
'@system.app'
//右滑退出
import
router
from
'@system.router'
//页面跳转
import
{
P2pClient
}
from
'../wearengine'
// 步骤1:创建点对点通信对象
var
p2pClient
=
new
P2pClient
();
export
default
{
data
:
{
...
...
@@ -31,7 +35,10 @@ export default {
},
onDestroy
()
{
//取消接收手机侧第三方应用发过来的消息
FeatureAbility
.
unsubscribeMsg
();
p2pClient
.
unregisterReceiver
({
onSuccess
:
function
()
{
},
});
},
start
(
msg
)
{
let
_this
=
this
;
...
...
@@ -52,13 +59,19 @@ export default {
*/
getMsg
()
{
let
_this
=
this
;
FeatureAbility
.
subscribeMsg
({
success
:
function
(
data
)
{
_this
.
start
(
JSON
.
parse
(
data
.
message
));
// 步骤4:接收手机侧第三方应用发过来的简短消息或文件
var
receiver
=
{
onSuccess
:
function
()
{
// 处理注册接收手机侧简短消息或文件成功的回调函数
},
fail
:
function
(
data
,
code
)
{
}
});
onFailure
:
function
()
{
// 处理注册接收手机侧简短消息或文件失败的回调函数
},
onReceiveMessage
:
function
(
data
)
{
_this
.
start
(
JSON
.
parse
(
data
));
},
}
p2pClient
.
registerReceiver
(
receiver
);
},
/**
...
...
entry/src/main/js/default/pages/index/index.js
View file @
7ffe7ac4
...
...
@@ -4,8 +4,13 @@ import brightness from '@system.brightness' //保持屏幕常亮
import
app
from
'@system.app'
//右滑退出
import
router
from
'@system.router'
//页面跳转
import
storage
from
'@system.storage'
//本地数据
import
{
P2pClient
,
Message
,
Builder
}
from
'../wearengine'
var
timer
;
// 步骤1:创建点对点通信对象
var
p2pClient
=
new
P2pClient
();
var
builderClient
=
new
Builder
();
var
sendMessage
=
new
Message
();
export
default
{
data
:
{
...
...
@@ -31,6 +36,9 @@ export default {
isFirstInit
:
true
,
//是否是第一次初始化事件
showPrivacy
:
true
,
//显示隐私权限页面
},
onInit
()
{
p2pClient
.
setPeerPkgName
(
"com.sportq.fit"
);
},
onReady
()
{
let
_this
=
this
;
//获取本地隐私权限标识
...
...
@@ -102,7 +110,10 @@ export default {
});
this
.
quit
();
//取消接收手机侧第三方应用发过来的消息
FeatureAbility
.
unsubscribeMsg
();
p2pClient
.
unregisterReceiver
({
onSuccess
:
function
()
{
},
});
},
start
(
msg
)
{
let
_this
=
this
;
...
...
@@ -323,16 +334,16 @@ export default {
*/
checkInstall
()
{
let
_this
=
this
;
FeatureAbility
.
detect
({
bundleName
:
'com.sportq.fit'
,
success
:
function
()
{
//已安装
p2pClient
.
ping
({
onSuccess
:
function
()
{
console
.
log
(
'ping success.'
);
},
fail
:
function
(
data
,
code
)
{
if
(
!
data
&&
!
code
)
{
//未安装
_this
.
page
=
"99"
;
_this
.
isJumpLoginPage
=
false
;
}
onFailure
:
function
()
{
_this
.
page
=
"99"
;
_this
.
isJumpLoginPage
=
false
;
},
onPingResult
:
function
(
resultCode
)
{
console
.
log
(
resultCode
.
data
+
resultCode
.
code
);
},
});
},
...
...
@@ -344,19 +355,26 @@ export default {
sendMsg
(
obj
)
{
let
_this
=
this
;
_this
.
sendFlg
=
true
;
FeatureAbility
.
sendMsg
({
deviceId
:
'remote'
,
bundleName
:
'com.sportq.fit'
,
message
:
JSON
.
stringify
(
obj
),
success
:
function
()
{
// 步骤4:发送简短消息到手机侧对应的第三方应用
builderClient
.
setDescription
(
JSON
.
stringify
(
obj
));
sendMessage
.
builder
=
builderClient
;
// 定义回调函数
var
sendCallback
=
{
onSuccess
:
function
()
{
_this
.
sendFlg
=
false
;
console
.
log
(
'sendMsg success.'
);
},
fail
:
function
(
data
,
code
)
{
onFailure
:
function
(
)
{
_this
.
sendFlg
=
false
;
console
.
log
(
'handing fail, message: '
+
data
+
', code: '
+
code
);
}
});
},
onSendResult
:
function
(
resultCode
)
{
// send任务执行结束后返回的错误码和信息进行处理
console
.
log
(
resultCode
.
data
+
resultCode
.
code
);
},
}
if
(
sendMessage
!=
null
&&
sendCallback
!=
null
)
{
p2pClient
.
send
(
sendMessage
,
sendCallback
);
}
;
},
/**
...
...
@@ -364,15 +382,23 @@ export default {
*/
sendHeartRateMsg
(
obj
)
{
let
_this
=
this
;
FeatureAbility
.
sendMsg
({
deviceId
:
'remote'
,
bundleName
:
'com.sportq.fit'
,
message
:
JSON
.
stringify
(
obj
),
success
:
function
()
{
// 步骤4:发送简短消息到手机侧对应的第三方应用
builderClient
.
setDescription
(
JSON
.
stringify
(
obj
));
sendMessage
.
builder
=
builderClient
;
// 定义回调函数
var
sendCallback
=
{
onSuccess
:
function
()
{
},
fail
:
function
(
data
,
code
)
{
}
});
onFailure
:
function
()
{
},
onSendResult
:
function
(
resultCode
)
{
console
.
log
(
resultCode
.
data
+
resultCode
.
code
);
},
}
if
(
sendMessage
!=
null
&&
sendCallback
!=
null
)
{
p2pClient
.
send
(
sendMessage
,
sendCallback
);
}
;
},
/**
...
...
@@ -394,13 +420,19 @@ export default {
*/
getMsg
()
{
let
_this
=
this
;
FeatureAbility
.
subscribeMsg
({
success
:
function
(
data
)
{
_this
.
start
(
JSON
.
parse
(
data
.
message
));
// 步骤4:接收手机侧第三方应用发过来的简短消息或文件
var
receiver
=
{
onSuccess
:
function
()
{
// 处理注册接收手机侧简短消息或文件成功的回调函数
},
fail
:
function
(
data
,
code
)
{
}
});
onFailure
:
function
()
{
// 处理注册接收手机侧简短消息或文件失败的回调函数
},
onReceiveMessage
:
function
(
data
)
{
_this
.
start
(
JSON
.
parse
(
data
));
},
}
p2pClient
.
registerReceiver
(
receiver
);
}
,
...
...
@@ -523,7 +555,10 @@ export default {
this
.
progress
=
""
,
//进度条
this
.
countdownT
=
""
,
// 倒计时
//取消接收手机侧第三方应用发过来的消息
FeatureAbility
.
unsubscribeMsg
();
p2pClient
.
unregisterReceiver
({
onSuccess
:
function
()
{
},
});
sensor
.
unsubscribeHeartRate
()
//取消监听心率
},
...
...
entry/src/main/js/default/wearable/wearengine.js
0 → 100644
View file @
7ffe7ac4
This diff is collapsed.
Click to expand it.
gradle/wrapper/gradle-wrapper.properties
View file @
7ffe7ac4
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
5.4.1
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
6.3
-all.zip
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
yucong0322.p7b
0 → 100644
View file @
7ffe7ac4
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment