Documentation ¶
Index ¶
Constants ¶
const (
// TimeFormat is the format of timestamps used by RRF
TimeFormat = "2006-01-02T15:04:05"
)
Variables ¶
var ErrDirectoryNotFound = errors.New("Directory not found")
ErrDirectoryNotFound is the error returned if a directory was not found
var ErrDriveNotMounted = errors.New("Drive not mounted")
ErrDriveNotMounted is the error returned if the requested drive is not mounted
var ErrFileNotFound = errors.New("File not found")
ErrFileNotFound is the error returned in case a call to the rr_fileinfo interface was successful but returned err != 0
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { // Type of file - can be file or directory Type string // Name of file Name string // Size of file in bytes Size uint64 // Timestamp corresponds to last modification date Timestamp localTime `json:"date"` }
File resembles the JSON object returned in the files property of the rr_filelist response
type Fileinfo ¶
type Fileinfo struct { // Err holds a numeric error code where 0 means no error Err uint64 // Size is the size of a file in bytes (0 for directories) Size uint64 Timestamp localTime `json:"lastModified"` // Height in mm for a job file Height float64 // FirstLayerHeight in mm for a job file FirstLayerHeight float64 // LayerHeight in mm for a job file LayerHeight float64 // PrintTime in seconds for a job file PrintTime uint64 // Filament contains an array of used filaments in mm Filament []float64 // GeneratedBy returns the string which application created the job file GeneratedBy string }
Fileinfo is the structure returned at rr_fileinfo interface
func (*Fileinfo) LastModified ¶
LastModified returns the last modification time of this file
type Filelist ¶
type Filelist struct { Dir string Files []File Next uint64 Err uint64 Subdirs []*Filelist // contains filtered or unexported fields }
Filelist resembled the JSON object in rr_filelist
type RRFFileManager ¶
type RRFFileManager interface { // Connect establishes a connection to RepRapFirmware Connect(password string) error // Filelist will download a list of all files (also including directories) for the given path. // If recursive is true it will also populate the field Subdirs of Filelist to contain the full // tree. Filelist(path string, recursive bool) (*Filelist, error) // Fileinfo returns information on a given file or an error if the file does not exist Fileinfo(path string) (*Fileinfo, error) // GetFile downloads a file with the given path also returning the duration of this action Download(filepath string) ([]byte, *time.Duration, error) // Mkdir creates a new directory with the given path Mkdir(path string) error // Move renames or moves a file or directory (only within the same SD card) Move(oldpath, newpath string) error // Delete removes the given path. It will fail for non-empty directories. Delete(path string) error // Upload uploads a new file to the given path on the SD card Upload(path string, content io.Reader) (*time.Duration, error) }
RRFFileManager provides means to interact with SD card contents on a machine using RepRapFirmware (RRF). It will communicate through its HTTP interface.