Documentation ¶
Index ¶
- Constants
- Variables
- type DirEntry
- type FS
- func (blefs *FS) Close() error
- func (blefs *FS) Create(path string, size uint32) (*File, error)
- func (blefs *FS) GoFS() fs.FS
- func (blefs *FS) Mkdir(path string) error
- func (blefs *FS) MkdirAll(path string) error
- func (blefs *FS) Open(path string) (*File, error)
- func (blefs *FS) ReadDir(path string) ([]fs.DirEntry, error)
- func (blefs *FS) Remove(path string) error
- func (blefs *FS) RemoveAll(path string) error
- func (blefs *FS) Rename(old, new string) error
- func (blefs *FS) Stat(path string) (fs.FileInfo, error)
- type FSError
- type File
- func (fl *File) Close() error
- func (file *File) Progress() <-chan uint32
- func (fl *File) Read(b []byte) (n int, err error)
- func (fl *File) Seek(offset int64, whence int) (int64, error)
- func (file *File) Size() uint32
- func (fl *File) Stat() (fs.FileInfo, error)
- func (fl *File) Write(b []byte) (n int, err error)
- func (fl *File) WriteString(s string) (n int, err error)
- type FileInfo
Constants ¶
const ( FSStatusOk = 0x01 FSStatusError = 0x02 )
const ( FSCmdReadFile = 0x10 FSCmdDataReq = 0x12 FSCmdWriteFile = 0x20 FSCmdTransfer = 0x22 FSCmdDelete = 0x30 FSCmdMkdir = 0x40 FSCmdListDir = 0x50 FSCmdMove = 0x60 )
Filesystem command
const ( FSResponseReadFile = 0x11 FSResponseWriteFile = 0x21 FSResponseDelete = 0x31 FSResponseMkdir = 0x41 FSResponseListDir = 0x51 FSResponseMove = 0x61 )
Filesystem response
Variables ¶
var ( ErrFileNotExists = errors.New("file does not exist") ErrFileReadOnly = errors.New("file is read only") ErrFileWriteOnly = errors.New("file is write only") ErrInvalidOffset = errors.New("invalid file offset") ErrOffsetChanged = errors.New("offset has already been changed") ErrReadOpen = errors.New("only one file can be opened for reading at a time") ErrWriteOpen = errors.New("only one file can be opened for writing at a time") ErrNoRemoveRoot = errors.New("refusing to remove root directory") )
Functions ¶
This section is empty.
Types ¶
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry represents an entry from a directory listing
func (DirEntry) Info ¶
Info returns the FileInfo for the file or subdirectory described by the entry.
func (DirEntry) IsDir ¶
IsDir reports whether the entry describes a directory.
func (DirEntry) Name ¶
Name returns the name of the file described by the entry
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS implements the fs.FS interface for the Adafruit BLE FS protocol
func New ¶
func New(transfer *gatt.GattCharacteristic1) (*FS, error)
New creates a new fs given the transfer characteristic
func (*FS) Create ¶
Create makes a new file on the BLE file system and returns it.
func (*FS) Mkdir ¶
Mkdir creates a directory at the given path
func (*FS) Open ¶
Open opens a file and returns it as an fs.File to satisfy the fs.FS interface
func (*FS) ReadDir ¶
ReadDir returns a list of directory entries from the given path
func (*FS) Rename ¶
Rename moves or renames a file or directory
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file on the BLE filesystem
func (*File) Progress ¶
Progress returns a channel that receives the amount of bytes sent as they are sent
func (*File) Read ¶
Read reads data from a file into b
func (*File) Seek ¶
Seek changes the offset of the file being read/written. This can only be done once in between reads/writes.
func (*File) Stat ¶
Stat does a ReadDir() and finds the current file in the output
func (*File) Write ¶
Write writes data from b into a file on the BLE filesysyem
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo implements fs.FileInfo
func (FileInfo) IsDir ¶
IsDir returns whether the file is a directory
func (FileInfo) ModTime ¶
ModTime returns the modification time of the file As of now, this is unimplemented in InfiniTime, and will always return 0.