Documentation ¶
Overview ¶
package linestogo allows decoding a .line file format version=5 from the reMarkable 2 into a Go structure
for more info, please cf:
- https://remarkablewiki.com/tech/filesystem?s[]=lines
- https://plasma.ninja/blog/devices/remarkable/binary/format/2017/12/26/reMarkable-lines-file-format.html
Example (StartPolling) ¶
package main import ( "context" "log" linestogo "github.com/owulveryck/linesToGo" ) func main() { ctx := context.Background() pageC, cancel, err := linestogo.StartPolling(ctx) if err != nil { log.Fatal(err) } defer cancel() for p := range pageC { log.Println("current page is:", p) } }
Output:
Example (Svg) ¶
package main import ( "encoding/xml" "log" "os" linestogo "github.com/owulveryck/linesToGo" ) func main() { p := &linestogo.Page{} err := linestogo.Read(os.Stdin, p) if err != nil { log.Fatal(err) } enc := xml.NewEncoder(os.Stdout) enc.Indent("", " ") err = enc.Encode(p) if err != nil { log.Fatal(err) } enc.Flush() }
Output:
Index ¶
- Constants
- Variables
- func Read(r io.Reader, p *Page) error
- func StartPolling(ctx context.Context) (<-chan string, context.CancelFunc, error)
- type Layer
- func (*Layer) Descriptor() ([]byte, []int)deprecated
- func (x *Layer) GetStrokes() []*Stroke
- func (l *Layer) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (*Layer) ProtoMessage()
- func (x *Layer) ProtoReflect() protoreflect.Message
- func (x *Layer) Reset()
- func (x *Layer) String() string
- type Page
- func (*Page) Descriptor() ([]byte, []int)deprecated
- func (x *Page) GetHeader() string
- func (x *Page) GetLayers() []*Layer
- func (p *Page) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (*Page) ProtoMessage()
- func (x *Page) ProtoReflect() protoreflect.Message
- func (x *Page) Reset()
- func (x *Page) String() string
- type RawPage
- type Segment
- func (*Segment) Descriptor() ([]byte, []int)deprecated
- func (x *Segment) GetDirection() float32
- func (x *Segment) GetPressure() float32
- func (x *Segment) GetSpeed() float32
- func (x *Segment) GetWidth() float32
- func (x *Segment) GetX() float32
- func (x *Segment) GetY() float32
- func (*Segment) ProtoMessage()
- func (x *Segment) ProtoReflect() protoreflect.Message
- func (x *Segment) Reset()
- func (x *Segment) String() string
- type Stroke
- func (*Stroke) Descriptor() ([]byte, []int)deprecated
- func (x *Stroke) GetPen() uint32
- func (x *Stroke) GetPenWidth() float32
- func (x *Stroke) GetSegments() []*Segment
- func (x *Stroke) GetStrokeColor() uint32
- func (s *Stroke) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (*Stroke) ProtoMessage()
- func (x *Stroke) ProtoReflect() protoreflect.Message
- func (x *Stroke) Reset()
- func (x *Stroke) String() string
Examples ¶
Constants ¶
View Source
const (
XochitlCacheDir = `/home/root/.local/share/remarkable/xochitl`
)
Variables ¶
View Source
var File_defs_proto protoreflect.FileDescriptor
Functions ¶
func StartPolling ¶ added in v0.1.1
StartPolling triggers two go-routines:
The first goroutine monitors the XochitlCacheDir. It feeds a channel with the directory containing the last modified notebook (based on the metadata)
The seecond go-routine is reading the notebook directory from the previous channel and monitors it It feeeds the output channel with the name of the current file which is likely the current page.
Caution: the remarkable is writing *a lot*, so a 50ms timer is set to prevent sending too many events on the chan
Types ¶
type Layer ¶
type Layer struct { Strokes []*Stroke `protobuf:"bytes,1,rep,name=strokes,proto3" json:"strokes,omitempty"` // contains filtered or unexported fields }
func (*Layer) Descriptor
deprecated
added in
v0.1.1
func (*Layer) GetStrokes ¶ added in v0.1.1
func (*Layer) MarshalXML ¶ added in v0.1.0
func (*Layer) ProtoMessage ¶ added in v0.1.1
func (*Layer) ProtoMessage()
func (*Layer) ProtoReflect ¶ added in v0.1.1
func (x *Layer) ProtoReflect() protoreflect.Message
type Page ¶
type Page struct { Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` Layers []*Layer `protobuf:"bytes,2,rep,name=layers,proto3" json:"layers,omitempty"` // contains filtered or unexported fields }
func (*Page) Descriptor
deprecated
added in
v0.1.1
func (*Page) MarshalXML ¶ added in v0.1.0
func (*Page) ProtoMessage ¶ added in v0.1.1
func (*Page) ProtoMessage()
func (*Page) ProtoReflect ¶ added in v0.1.1
func (x *Page) ProtoReflect() protoreflect.Message
type RawPage ¶ added in v0.1.1
type RawPage struct { Page []byte `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"` // contains filtered or unexported fields }
func (*RawPage) Descriptor
deprecated
added in
v0.1.1
func (*RawPage) ProtoMessage ¶ added in v0.1.1
func (*RawPage) ProtoMessage()
func (*RawPage) ProtoReflect ¶ added in v0.1.1
func (x *RawPage) ProtoReflect() protoreflect.Message
type Segment ¶
type Segment struct { X float32 `protobuf:"fixed32,1,opt,name=x,proto3" json:"x,omitempty"` Y float32 `protobuf:"fixed32,2,opt,name=y,proto3" json:"y,omitempty"` Speed float32 `protobuf:"fixed32,3,opt,name=speed,proto3" json:"speed,omitempty"` Width float32 `protobuf:"fixed32,4,opt,name=width,proto3" json:"width,omitempty"` Direction float32 `protobuf:"fixed32,5,opt,name=direction,proto3" json:"direction,omitempty"` Pressure float32 `protobuf:"fixed32,6,opt,name=pressure,proto3" json:"pressure,omitempty"` // contains filtered or unexported fields }
func (*Segment) Descriptor
deprecated
added in
v0.1.1
func (*Segment) GetDirection ¶ added in v0.1.1
func (*Segment) GetPressure ¶ added in v0.1.1
func (*Segment) ProtoMessage ¶ added in v0.1.1
func (*Segment) ProtoMessage()
func (*Segment) ProtoReflect ¶ added in v0.1.1
func (x *Segment) ProtoReflect() protoreflect.Message
type Stroke ¶
type Stroke struct { Pen uint32 `protobuf:"varint,1,opt,name=pen,proto3" json:"pen,omitempty"` StrokeColor uint32 `protobuf:"varint,2,opt,name=stroke_color,json=strokeColor,proto3" json:"stroke_color,omitempty"` PenWidth float32 `protobuf:"fixed32,3,opt,name=pen_width,json=penWidth,proto3" json:"pen_width,omitempty"` Segments []*Segment `protobuf:"bytes,4,rep,name=segments,proto3" json:"segments,omitempty"` // contains filtered or unexported fields }
func (*Stroke) Descriptor
deprecated
added in
v0.1.1
func (*Stroke) GetPenWidth ¶ added in v0.1.1
func (*Stroke) GetSegments ¶ added in v0.1.1
func (*Stroke) GetStrokeColor ¶ added in v0.1.1
func (*Stroke) MarshalXML ¶ added in v0.1.0
MarshalXML creates a SVG representation of the stroke
func (*Stroke) ProtoMessage ¶ added in v0.1.1
func (*Stroke) ProtoMessage()
func (*Stroke) ProtoReflect ¶ added in v0.1.1
func (x *Stroke) ProtoReflect() protoreflect.Message
Source Files ¶
Click to show internal directories.
Click to hide internal directories.