2.4.1 • Published 7 months ago

dgcp v2.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Printer Module

Supported Commands

  • machineStatus
  • resetCounting
  • resetCountingRibbon
  • getCurrentFilename
  • startJob
  • StopJob

Installation

npm install dgcp

or

yarn add dgcp

Usage

import { getCurrentFilename, machineStatus, resetCounting } from "dgcp";

// Start Job
machineStatus(host, port)
  .then(function (data) {
    return res.status(200).json({
      success: true,
      message: "Job Has Been Started successfully",
      data: data,
    });
  })
  .catch(function (err) {
    logger.error(`Error getting start job: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error getting start job",
      data: null,
    });
  });

// Stop Job
machineStatus(host, port)
  .then(function (data) {
    return res.status(200).json({
      success: true,
      message: "Job Has Been Stopped successfully",
      data: data,
    });
  })
  .catch(function (err) {
    logger.error(`Error getting stop job: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error getting stop job",
      data: null,
    });
  });

// Machine Status
machineStatus(host, port)
  .then(function (data) {
    return res.status(200).json({
      success: true,
      message: "Machine status",
      data: data,
    });
  })
  .catch(function (err) {
    logger.error(`Error getting machine status: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error getting machine status",
      data: null,
    });
  });

// Reset Counting
resetCounting(host, port)
  .then(function () {
    return res.status(200).json({
      success: true,
      message: "Counting reset successfully",
    });
  })
  .catch(function (err) {
    logger.error(`Error resetting counting: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error resetting counting",
      data: null,
    });
  });

// Reset Counting Ribbons
resetCountingRibbon(host, port)
  .then(function () {
    return res.status(200).json({
      success: true,
      message: "Counting reset successfully",
    });
  })
  .catch(function (err) {
    logger.error(`Error resetting counting: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error resetting counting",
      data: null,
    });
  });

// Get Current Filename
getCurrentFilename(host, port)
  .then(function (data) {
    return res.status(200).json({
      success: true,
      message: "Current filename",
      data: data,
    });
  })
  .catch(function (err) {
    logger.error(`Error getting current filename: ${err}`);
    return res.status(500).json({
      success: false,
      message: "Error getting current filename",
      data: null,
    });
  });
2.3.0

7 months ago

2.4.1

7 months ago

2.3.2

7 months ago

2.4.0

7 months ago

2.3.1

7 months ago

2.2.2

7 months ago

2.2.1

7 months ago

2.2.0

7 months ago

2.1.4

7 months ago

2.1.3

7 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.0.0

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago