Skip to content

Component API

Overview

The Component API provides detailed information about each component in the ECO SDK.

Eco.Core1 Component

Description

The core component that provides fundamental system functionality.

Methods

initialize(): void

Initializes the core component.

shutdown(): void

Shuts down the core component gracefully.

getStatus(): ComponentStatus

Returns the current status of the core component.

Properties

  • version: The version of the core component
  • status: Current operational status
  • uptime: How long the component has been running

Eco.FileSystemManagement1 Component

Description

Provides file system operations and management capabilities.

Methods

createDirectory(path: string): boolean

Creates a new directory at the specified path.

deleteFile(path: string): boolean

Deletes the file at the specified path.

copyFile(source: string, destination: string): boolean

Copies a file from source to destination.

moveFile(source: string, destination: string): boolean

Moves a file from source to destination.

listDirectory(path: string): FileInfo[]

Lists the contents of a directory.

Properties

  • currentDirectory: The current working directory
  • availableSpace: Available disk space
  • totalSpace: Total disk space

Eco.InterfaceBus1 Component

Description

Manages communication between different components.

Methods

registerComponent(component: Component): void

Registers a component with the interface bus.

unregisterComponent(componentId: string): void

Unregisters a component from the interface bus.

sendEvent(event: Event): void

Sends an event to registered components.

subscribe(eventType: string, handler: EventHandler): void

Subscribes to specific event types.

Properties

  • registeredComponents: List of registered components
  • eventQueue: Current event queue
  • messageCount: Total message count

Eco.MemoryManager1 Component

Description

Provides memory management functionality.

Methods

allocateMemory(size: number, type: MemoryType): Pointer

Allocates memory of the specified size and type.

deallocateMemory(pointer: Pointer): void

Deallocates memory at the specified pointer.

getMemoryUsage(): MemoryUsage

Returns current memory usage statistics.

compactMemory(): void

Compacts memory to reduce fragmentation.

Properties

  • totalMemory: Total available memory
  • usedMemory: Currently used memory
  • freeMemory: Free available memory
  • fragmentationLevel: Current memory fragmentation level

EcoDateTime1 Component

Description

Provides date and time manipulation utilities.

Methods

getCurrentDateTime(): DateTime

Returns the current date and time.

formatDateTime(dateTime: DateTime, format: string): string

Formats a date time according to the specified format.

parseDateTime(dateTimeString: string, format: string): DateTime

Parses a date time string according to the specified format.

addTime(dateTime: DateTime, duration: Duration): DateTime

Adds a duration to a date time.

Properties

  • timezone: Current timezone
  • format: Default date time format
  • precision: Time precision

EcoLog1 Component

Description

Provides comprehensive logging functionality.

Methods

log(level: LogLevel, message: string, context?: any): void

Logs a message at the specified level.

debug(message: string, context?: any): void

Logs a debug message.

info(message: string, context?: any): void

Logs an info message.

warn(message: string, context?: any): void

Logs a warning message.

error(message: string, context?: any): void

Logs an error message.

setLogLevel(level: LogLevel): void

Sets the minimum log level.

addOutput(output: LogOutput): void

Adds a new log output destination.

Properties

  • currentLogLevel: Current minimum log level
  • outputs: List of log outputs
  • logCount: Total number of log entries

EcoMathFFT1 Component

Description

Provides Fast Fourier Transform functionality.

Methods

fft(input: number[]): Complex[]

Performs Fast Fourier Transform on the input array.

ifft(input: Complex[]): number[]

Performs Inverse Fast Fourier Transform on the input array.

dft(input: number[]): Complex[]

Performs Discrete Fourier Transform on the input array.

getWindow(windowType: WindowType, size: number): number[]

Generates a window function of the specified type and size.

Properties

  • fftSize: Current FFT size
  • windowType: Current window type
  • sampleRate: Current sample rate

Component Integration

Example Usage

javascript
// Initialize components
const core = new Eco.Core1();
const memoryManager = new Eco.MemoryManager1();
const fileSystem = new Eco.FileSystemManagement1();

// Register with interface bus
const bus = new Eco.InterfaceBus1();
bus.registerComponent(core);
bus.registerComponent(memoryManager);
bus.registerComponent(fileSystem);

// Use components
const memory = memoryManager.allocateMemory(1024, 'HEAP');
fileSystem.createDirectory('/tmp');
core.getStatus();

Error Handling

All components implement consistent error handling:

  • Methods return null or false on failure
  • Detailed error information is available through the logging system
  • Components maintain their state even after errors

Performance Considerations

  • Memory allocations should be minimized in performance-critical sections
  • File operations should use buffering for better performance
  • Interface bus messages should be kept small and focused
  • FFT operations should use appropriate window functions