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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ate_tbox

v1.0.11

Published

ATE TBox Api with nodejs

Downloads

44

Readme

Describe

ATE TBox Api with nodejs

Install

npm install ate_tbox

Method description

Attribute: drivers(array)

Host driver array, driver contents include: name: device/driver name. vendor: device vendor. library: driver library path.

Method: OpenDevice(library)

This function is used to establish a connection and intialize the Pass-Thru Device and setup connect protocol channel. library: String, device library path. return: int, 0 is success.

Method: CloseDevice()

This function is used to close the connection to a Pass-Thru Device. return: int, 0 is success.

Method: SelectDrawer(index)

This function select drawer to connect. index: drawer index, range: 0 - 20, 0 is close all drawer connect.

Method: SetupDutPower(flags, limit_max, limit_min)

This function setup drawer dut power supply and protection Parameters. flags: dut power supply switch flags. limit_max: max current(mA), when the current is greater than that value, the power is off. limit_min: min current(mA), when the current is less than that value, the power is off.

Method: StartSingleTest(interval, eventCB)

This function is used to start single test. interval: drawer refresh interval(s). eventCB: event callback.

Method: StartMultiTest(interval, duration, flags, eventCB)

This function is used to start multi drawer test. interval: drawer refresh interval(s). duration: duration test time(s). flags: drawer refresh list flags. eventCB: event callback.

Method: StopMultiTest()

This function is used to stop multi drawer test.

CallBack: eventCB

Function to call when the dut information is updated or the test exits.

Usage Example

const AteApi = require('..');

function eventHandle(event) {
    if ("update" == event.event) {
        /* 更新dut信息 */
        for(var i = 0; i < event.duts.length; i++){
            console.log("<%d-%d>: sw[%d] avg[%d] min[%d] max[%d]", 
                event.index,
                i, 
                event.duts[i].sw,
                event.duts[i].avg,
                event.duts[i].min,
                event.duts[i].max);
        } 
    } else if ("exit" == event.event) {
        if (event.code == 0) {
            console.log("test done");   
        } else {
            console.log("User Request Exit");  
        }
        /* 关闭设备 */
        if (0 != AteApi.CloseDevice()) {
            console.log("device close failure.");
        } else {
            console.log("device close success.");   
        }
    } else {
        console.log("undefinition event %s.", event.event);  
    }
}

function singleTest() {
    var interval = 2;
    if (0 != AteApi.StartSingleTest(interval, eventHandle)) {
        console.log("Start Single Test failure."); 
        AteApi.CloseDevice();
        process.exit();
    } 
}

function multiTest() {
    var interval = 2;
    var duration = 30;
    var flags = 0x5;
    if (0 != AteApi.StartMultiTest(interval, duration, flags, eventHandle)) {
        console.log("Start Single Test failure."); 
        AteApi.CloseDevice();
        process.exit();
    } 
}

function doTest() {
    for(let i = 0; i < AteApi.drivers.length; i++){
        console.log("Discover Driver: ", AteApi.drivers[i].name);
    }
    /* 打开设备 */
    if (0 != AteApi.OpenDevice(AteApi.drivers[2].library)) {
        console.log("device open failure."); 
        process.exit();
    } 
    console.log("device open success."); 
    /* 选择通信抽屉 */
    if (0 != AteApi.SelectDrawer(1)) {
        console.log("Select Drawer failure."); 
        AteApi.CloseDevice();
        process.exit();
    } 
    /* 设置DUT电源 */
    if (0 != AteApi.SetupDutPower(0xFFF, 800, 200)) {
         console.log("Setup Dut Power failure."); 
         AteApi.CloseDevice();
         process.exit();
    } 
    //singleTest();
    multiTest();
}