|
| 1 | +/* |
| 2 | + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License |
| 15 | + */ |
| 16 | + |
| 17 | +package stm |
| 18 | + |
| 19 | +import ( |
| 20 | + "log" |
| 21 | + "time" |
| 22 | +) |
| 23 | + |
| 24 | +// Dummy is a dummy implementation of Interface. |
| 25 | +// It logs to the standard logger from "log" package. |
| 26 | +type Dummy struct { |
| 27 | + ctx string |
| 28 | +} |
| 29 | + |
| 30 | +// NewDummy return a dummy implementation of Interface. |
| 31 | +// Each message will be prefixed with context. |
| 32 | +func NewDummy(context string) InterfaceCloser { |
| 33 | + return &Dummy{ctx: context} |
| 34 | +} |
| 35 | + |
| 36 | +// Close prints "Close" to the standard logger. |
| 37 | +func (d *Dummy) Close() error { |
| 38 | + log.Println(d.ctx, "Close") |
| 39 | + return nil |
| 40 | +} |
| 41 | + |
| 42 | +// PowerTick prints "PowerTick" and duration argument to the standard logger. |
| 43 | +func (d *Dummy) PowerTick(duration time.Duration) error { |
| 44 | + log.Println(d.ctx, "PowerTick", duration) |
| 45 | + return nil |
| 46 | +} |
| 47 | + |
| 48 | +// SetLED prints "SetLED" and arguments to the standard logger. |
| 49 | +func (d *Dummy) SetLED(led LED, r, g, b uint8) error { |
| 50 | + log.Println(d.ctx, "SetLED", led, r, g, b) |
| 51 | + return nil |
| 52 | +} |
| 53 | + |
| 54 | +// ClearDisplay prints "ClearDisplay" to the standard logger. |
| 55 | +func (d *Dummy) ClearDisplay() error { |
| 56 | + log.Println(d.ctx, "ClearDisplay") |
| 57 | + return nil |
| 58 | +} |
| 59 | + |
| 60 | +// PrintText prints "PrintText" and arguments to the standard logger. |
| 61 | +func (d *Dummy) PrintText(x, y uint, color Color, text string) error { |
| 62 | + log.Println(d.ctx, "PrintText", x, y, color, text) |
| 63 | + return nil |
| 64 | +} |
| 65 | + |
| 66 | +// DUT prints "DUT" to the standard logger. |
| 67 | +func (d *Dummy) DUT() error { |
| 68 | + log.Println(d.ctx, "DUT") |
| 69 | + return nil |
| 70 | +} |
| 71 | + |
| 72 | +// TS prints "TS" to the standard logger. |
| 73 | +func (d *Dummy) TS() error { |
| 74 | + log.Println(d.ctx, "TS") |
| 75 | + return nil |
| 76 | +} |
| 77 | + |
| 78 | +// GetCurrent prints "GetCurrent" to the standard logger and returns 0. |
| 79 | +func (d *Dummy) GetCurrent() (int, error) { |
| 80 | + log.Println(d.ctx, "GetCurrent") |
| 81 | + return 0, nil |
| 82 | +} |
| 83 | + |
| 84 | +// StartCurrentRecord prints "StartCurrentRecord" and arguments to the standard logger. |
| 85 | +func (d *Dummy) StartCurrentRecord(samples int, interval time.Duration) error { |
| 86 | + log.Println(d.ctx, "StartCurrentRecord", samples, interval) |
| 87 | + return nil |
| 88 | +} |
| 89 | + |
| 90 | +// StopCurrentRecord prints "StopCurrentRecord" to the standard logger. |
| 91 | +func (d *Dummy) StopCurrentRecord() error { |
| 92 | + log.Println(d.ctx, "StopCurrentRecord") |
| 93 | + return nil |
| 94 | +} |
| 95 | + |
| 96 | +// GetCurrentRecord prints "GetCurrentRecord" to the standard logger and returns nil. |
| 97 | +func (d *Dummy) GetCurrentRecord() ([]int, error) { |
| 98 | + log.Println(d.ctx, "GetCurrentRecord") |
| 99 | + return nil, nil |
| 100 | +} |
| 101 | + |
| 102 | +// HDMI prints "HDMI" and argument to the standard logger. |
| 103 | +func (d *Dummy) HDMI(on bool) (err error) { |
| 104 | + log.Println(d.ctx, "HDMI", on) |
| 105 | + return nil |
| 106 | +} |
| 107 | + |
| 108 | +// SetDyper prints "SetDyper" and arguments to the standard logger. |
| 109 | +func (d *Dummy) SetDyper(dyper Dyper, on bool) error { |
| 110 | + log.Println(d.ctx, "SetDyper", dyper, on) |
| 111 | + return nil |
| 112 | +} |
0 commit comments