Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
augustctl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
augustctl
Commits
32fda0f4
Verified
Commit
32fda0f4
authored
Aug 30, 2016
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce method to check if lock is in some state of connection
parent
27d265fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
lib/lock.js
lib/lock.js
+25
-11
No files found.
lib/lock.js
View file @
32fda0f4
...
...
@@ -53,24 +53,24 @@ Lock.prototype.connect = function() {
// initialize the secure session
this
.
_secureSession
=
new
SecureLockSession
(
this
.
_peripheral
,
characteristicByUuid
(
"
bd4ac6130b4511e38ffd0800200c9a66
"
),
characteristicByUuid
(
"
bd4ac6140b4511e38ffd0800200c9a66
"
),
this
.
_offlineKeyOffset
this
.
_peripheral
,
characteristicByUuid
(
"
bd4ac6130b4511e38ffd0800200c9a66
"
),
characteristicByUuid
(
"
bd4ac6140b4511e38ffd0800200c9a66
"
),
this
.
_offlineKeyOffset
);
this
.
_secureSession
.
setKey
(
this
.
_offlineKey
);
// intialize the session
this
.
_session
=
new
LockSession
(
this
.
_peripheral
,
characteristicByUuid
(
"
bd4ac6110b4511e38ffd0800200c9a66
"
),
characteristicByUuid
(
"
bd4ac6120b4511e38ffd0800200c9a66
"
)
this
.
_peripheral
,
characteristicByUuid
(
"
bd4ac6110b4511e38ffd0800200c9a66
"
),
characteristicByUuid
(
"
bd4ac6120b4511e38ffd0800200c9a66
"
)
);
// start the sessions
return
Promise
.
join
(
this
.
_secureSession
.
start
(),
this
.
_session
.
start
()
this
.
_secureSession
.
start
(),
this
.
_session
.
start
()
);
}.
bind
(
this
)).
then
(
function
()
{
// send SEC_LOCK_TO_MOBILE_KEY_EXCHANGE
...
...
@@ -127,9 +127,9 @@ Lock.prototype.lock = function() {
Lock
.
prototype
.
unlock
=
function
()
{
return
this
.
status
(
true
).
then
(
function
(
status
)
{
if
(
status
==
'
locked
'
)
if
(
status
==
'
locked
'
)
return
this
.
forceUnlock
();
}.
bind
(
this
));
}.
bind
(
this
));
};
Lock
.
prototype
.
status
=
function
()
{
...
...
@@ -178,4 +178,18 @@ Lock.prototype.disconnect = function() {
}
};
Lock
.
prototype
.
isConnected
=
function
()
{
debug
(
'
checking connection...
'
);
if
(
this
.
_session
instanceof
LockSession
&&
'
undefined
'
!==
typeof
this
.
_session
.
_peripheral
.
state
&&
'
disconnected
'
!==
this
.
_session
.
_peripheral
.
state
)
{
return
true
;
}
return
false
;
};
module
.
exports
=
Lock
;
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