-
Notifications
You must be signed in to change notification settings - Fork 1
/
session.go
76 lines (59 loc) · 1.42 KB
/
session.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package selenium
import (
"github.com/antchfx/xmlquery"
"github.com/fsuhrau/automationhub/app"
"github.com/fsuhrau/automationhub/device"
"github.com/fsuhrau/automationhub/hub/manager"
"github.com/sirupsen/logrus"
"time"
)
type Session struct {
logger *logrus.Logger
XmlDocument *xmlquery.Node
timeout time.Duration
lock *manager.DeviceLock
AppParameter *app.Parameter
storage manager.Storage
lastAccess time.Time
}
func (s *Session) GetLogger() *logrus.Entry {
return s.logger.WithField("session", s.GetSessionID())
}
func (s *Session) GetSessionID() string {
return ""
}
func (s *Session) SetDeviceLock(lock *manager.DeviceLock) {
s.lock = lock
}
func (s *Session) GetDeviceLock() *manager.DeviceLock {
return s.lock
}
func (s *Session) GetActionTimeout() time.Time {
return time.Now().Add(s.timeout)
}
func (s *Session) SetActionTimeout(duration time.Duration) {
s.timeout = duration
}
func (s *Session) GetDevice() device.Device {
return s.lock.Device
}
func (s *Session) WaitForConnection() error {
return nil
}
func (s *Session) GetLastAccess() time.Time {
return s.lastAccess
}
func (s *Session) SetLastAccess(now time.Time) {
s.lastAccess = now
}
func (s *Session) Close() error {
return nil
}
func (s *Session) GetAppParameter() *app.Parameter {
return s.AppParameter
}
func (s *Session) GetStorage() manager.Storage {
return s.storage
}
func (s *Session) HandleDisconnect() {
}