mirror of
https://github.com/taigrr/adb.git
synced 2026-04-02 02:58:42 -07:00
in-progress adding start and end times to events for sleep calculations
This commit is contained in:
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: taigrr # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
44
capture.go
44
capture.go
@@ -30,9 +30,18 @@ func (s SequenceSleep) Length() time.Duration {
|
|||||||
return s.Duration
|
return s.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s SequenceSleep) StartTime() time.Time{
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s SequenceSwipe) StartTime() time.Time{
|
||||||
|
return s.Start
|
||||||
|
}
|
||||||
type SequenceTap struct {
|
type SequenceTap struct {
|
||||||
X int
|
X int
|
||||||
Y int
|
Y int
|
||||||
|
Start time.Time
|
||||||
|
End time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SequenceTap) Play(d Device, ctx context.Context) error {
|
func (s SequenceTap) Play(d Device, ctx context.Context) error {
|
||||||
@@ -43,18 +52,27 @@ func (s SequenceTap) Length() time.Duration {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s SequenceSwipe) StartTime() time.Time{
|
||||||
|
return s.Start
|
||||||
|
}
|
||||||
type SequenceSwipe struct {
|
type SequenceSwipe struct {
|
||||||
X1 int
|
X1 int
|
||||||
Y1 int
|
Y1 int
|
||||||
X2 int
|
X2 int
|
||||||
Y2 int
|
Y2 int
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
|
Start time.Time
|
||||||
|
End time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SequenceSwipe) Play(d Device, ctx context.Context) error {
|
func (s SequenceSwipe) Play(d Device, ctx context.Context) error {
|
||||||
return d.Swipe(ctx, s.X1, s.Y1, s.X2, s.Y2, s.Duration)
|
return d.Swipe(ctx, s.X1, s.Y1, s.X2, s.Y2, s.Duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s SequenceSwipe) StartTime() time.Time{
|
||||||
|
return s.Start
|
||||||
|
}
|
||||||
|
|
||||||
func (s SequenceSwipe) Length() time.Duration {
|
func (s SequenceSwipe) Length() time.Duration {
|
||||||
return s.Duration
|
return s.Duration
|
||||||
}
|
}
|
||||||
@@ -62,6 +80,8 @@ func (s SequenceSwipe) Length() time.Duration {
|
|||||||
type Input interface {
|
type Input interface {
|
||||||
Play(d Device, ctx context.Context) error
|
Play(d Device, ctx context.Context) error
|
||||||
Length() time.Duration
|
Length() time.Duration
|
||||||
|
StartTime() time.Time
|
||||||
|
EndTime() time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type TapSequence struct {
|
type TapSequence struct {
|
||||||
@@ -173,12 +193,27 @@ func parseGetEvent(input string) (events []Input) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func touchesToInputs([][]event) []Input {
|
func touchesToInputs(events []eventSet) []Input {
|
||||||
return []Input{}
|
inputs := []Input{}
|
||||||
|
for _, eventSet := range events {
|
||||||
|
i, err := eventSet.ToInput()
|
||||||
|
if err != nil {
|
||||||
|
inputs = append(inputs, i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inputs
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEventSlices(events []event) [][]event {
|
type eventSet []event
|
||||||
eventSets := [][]event{{}}
|
|
||||||
|
func (e eventSet) ToInput() (Input, error) {
|
||||||
|
var i Input
|
||||||
|
// i =
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getEventSlices(events []event) []eventSet {
|
||||||
|
eventSets := []eventSet{{}}
|
||||||
current := 0
|
current := 0
|
||||||
foundDown := false
|
foundDown := false
|
||||||
for _, e := range events {
|
for _, e := range events {
|
||||||
@@ -197,7 +232,6 @@ func getEventSlices(events []event) [][]event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
eventSets = eventSets[:len(eventSets)-1]
|
eventSets = eventSets[:len(eventSets)-1]
|
||||||
// fmt.Println(eventSets[len(eventSets)-1])
|
|
||||||
return eventSets
|
return eventSets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user