npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@leonardojc/capacitor-ioboard

v2.0.13

Published

A comprehensive Capacitor plugin for IOBoard devices with integrated serial communication and complete MTC3P08L protocol support including OTA updates

Readme

🚀 IOBoard Plugin v2.0 - Integrated Serial + Protocol

@leonardojc/capacitor-ioboard v2.0.0 - Complete IOBoard control with integrated serial communication

✨ What's New in v2.0

  • 🔗 Integrated Serial Communication - No need for separate serial plugin
  • 🎯 Simplified API - Single plugin handles everything
  • ⚡ Real-time Events - Connection state, data received, error handling
  • 🎨 Enhanced Color Control - Predefined colors and custom RGB support
  • 🚀 Complete OTA Support - Firmware updates with progress tracking
  • 🌐 Web Compatible - Works in browser with simulation mode

📦 Installation

npm install @leonardojc/[email protected]
npx cap sync

🚀 Quick Start

import { ioboard } from '@leonardojc/capacitor-ioboard';

// Connect to device
const result = await ioboard.connect('/dev/ttyS2', 115200);

// Unlock pallet with green color
await ioboard.unlockPallet(1, 3, 'GREEN', {
  intensity: 100,
  blinkTimes: 3,
  blinkSpeed: 2
});

// Set all pallets to red
await ioboard.setAllPalletsColor(1, 'RED');

// Get device status
const status = await ioboard.getStatus(1);
console.log(\`Firmware: \${status.status.firmwareVersion}\`);

📚 Complete API Reference

🔌 Connection Methods

connect(portPath?, baudRate?)

Connect to IOBoard device

await ioboard.connect('/dev/ttyS2', 115200);

disconnect()

Disconnect from device

await ioboard.disconnect();

isDeviceConnected()

Check connection status

const status = await ioboard.isDeviceConnected();
console.log(status.connected); // true/false

listPorts()

List available serial ports

const result = await ioboard.listPorts();
console.log(result.ports); // ['/dev/ttyS0', '/dev/ttyS1', ...]

🎮 IOBoard Device Methods

getStatus(address)

Get device status and information

const result = await ioboard.getStatus(1);
console.log(result.status);
// {
//   address: 1,
//   connected: true,
//   firmwareVersion: "2.1.0",
//   palletStates: [false, false, ...], // 8 pallets
//   temperature: 25.5,
//   voltage: 12.0,
//   uptime: 86400
// }

unlockPallet(address, palletNumber, color, options?)

Unlock specific pallet with color and effects

await ioboard.unlockPallet(1, 3, 'GREEN', {
  intensity: 100,      // 0-100
  blinkTimes: 3,       // Number of blinks (0 = solid)
  blinkSpeed: 2        // Blink speed (1-5)
});

// Using custom RGB color
await ioboard.unlockPallet(1, 5, { red: 255, green: 128, blue: 0 });

setAllPalletsColor(address, color, options?)

Set color for all 8 pallets

await ioboard.setAllPalletsColor(1, 'BLUE', {
  intensity: 80,
  blinkTimes: 0  // Solid color
});

controlMultipleLEDs(address, ledConfigs)

Control each pallet individually

const configs = [
  { color: 'RED', intensity: 100 },
  { color: 'GREEN', intensity: 90 },
  { color: 'BLUE', intensity: 80 },
  { color: { red: 255, green: 128, blue: 0 }, intensity: 70 },
  // ... up to 8 configurations
];

await ioboard.controlMultipleLEDs(1, configs);

🎨 Predefined Colors

Available color presets:

  • RED, GREEN, BLUE
  • YELLOW, MAGENTA, CYAN
  • WHITE, OFF
  • ORANGE, PURPLE, PINK, LIME
// Using predefined colors
await ioboard.unlockPallet(1, 0, 'PURPLE');

// Using custom RGB
await ioboard.unlockPallet(1, 1, { red: 128, green: 64, blue: 192 });

// Get available colors
const colors = ioboard.getColorPresets();

🚀 OTA Firmware Update

startOTAUpdate(address, fileName, fileSize)

Initialize OTA update process

await ioboard.startOTAUpdate(1, 'firmware.bin', 32768);

sendOTAData(address, packetNumber, data)

Send OTA data packet

await ioboard.sendOTAData(1, 0, [0x48, 0x65, 0x6C, 0x6C, 0x6F]); // "Hello"

performOTAUpdate(address, file, onProgress?)

Complete OTA update with progress callback

const file = new File([firmwareData], 'firmware.bin');

await ioboard.performOTAUpdate(1, file, (progress, packet, total) => {
  console.log(\`Progress: \${progress.toFixed(1)}% (\${packet}/\${total})\`);
});

📡 Event Handling

addDataReceivedListener(callback)

Listen for data received from device

await ioboard.addDataReceivedListener((event) => {
  console.log('Data received:', event);
});

addConnectionStateListener(callback)

Listen for connection state changes

await ioboard.addConnectionStateListener((event) => {
  console.log(\`Connection: \${event.connected}\`);
});

addSerialErrorListener(callback)

Listen for serial communication errors

await ioboard.addSerialErrorListener((event) => {
  console.error('Serial error:', event.error);
});

removeAllListeners()

Remove all event listeners

await ioboard.removeAllListeners();

🛠️ Utility Methods

getConnectionInfo()

Get current connection information

const info = ioboard.getConnectionInfo();
console.log(info.isConnected, info.currentPort);

createColor(red, green, blue)

Create RGB color object

const orange = ioboard.createColor(255, 165, 0);
await ioboard.unlockPallet(1, 0, orange);

🌟 React Component Example

import React, { useState, useEffect } from 'react';
import { ioboard } from '@leonardojc/capacitor-ioboard';

const IOBoardController = () => {
  const [isConnected, setIsConnected] = useState(false);

  useEffect(() => {
    // Setup event listeners
    ioboard.addConnectionStateListener((event) => {
      setIsConnected(event.connected);
    });

    return () => {
      ioboard.removeAllListeners();
    };
  }, []);

  const handleConnect = async () => {
    const result = await ioboard.connect('/dev/ttyS2');
    if (result.success) {
      console.log('Connected successfully!');
    }
  };

  const handleUnlockPallet = async (pallet) => {
    await ioboard.unlockPallet(1, pallet, 'GREEN', {
      intensity: 100,
      blinkTimes: 3
    });
  };

  return (
    <div>
      <button onClick={handleConnect} disabled={isConnected}>
        {isConnected ? 'Connected' : 'Connect'}
      </button>
      
      {isConnected && (
        <div>
          {[0,1,2,3,4,5,6,7].map(pallet => (
            <button 
              key={pallet} 
              onClick={() => handleUnlockPallet(pallet)}
            >
              Unlock Pallet {pallet}
            </button>
          ))}
        </div>
      )}
    </div>
  );
};

📋 MTC3P08L Protocol

The plugin implements the complete MTC3P08L protocol:

  • Device Status - Get firmware version, temperature, voltage
  • Pallet Control - Individual pallet unlock with RGB LEDs
  • Multiple Control - Control all 8 pallets simultaneously
  • OTA Updates - Complete firmware update support
  • Error Handling - Comprehensive error reporting

🔧 Configuration

Default connection settings:

  • Baud Rate: 115200
  • Data Bits: 8
  • Stop Bits: 1
  • Parity: None
  • Default Port: '/dev/ttyS2'

🌐 Platform Support

  • Android - Full native support
  • iOS - Full native support
  • Web - Simulation mode for testing

🆚 Migration from v1.x

Version 2.0 is a complete rewrite with breaking changes:

Before (v1.x - Two plugins)

// Required two separate plugins
import { CapacitorSerialPort } from '@leonardojc/capacitor-serial-port';
import { CapacitorIoboard } from '@leonardojc/capacitor-ioboard';

// Complex coordination required
await CapacitorSerialPort.connect({...});
await CapacitorIoboard.unlockPallet({...});

After (v2.0 - Single plugin)

// Single integrated plugin
import { ioboard } from '@leonardojc/capacitor-ioboard';

// Simple, unified API
await ioboard.connect('/dev/ttyS2');
await ioboard.unlockPallet(1, 3, 'GREEN');

🔗 Links

📄 License

MIT License - see LICENSE file for details.


🎉 IOBoard v2.0 - Simplified, Powerful, Complete!

Single plugin, comprehensive control, zero hassle. Everything you need for IOBoard device integration.