1.0.2 • Published 8 years ago

brothermfc v1.0.2

Weekly downloads
2
License
Unlicense
Repository
github
Last release
8 years ago

brothermfc

Access Brother MFC web UI details with node.js

npm Build Status Dependency Status

Example

var brother = require ('brothermfc') ({
  hostname: 'myprinter.lan'
});

brother.current (function (err, data) {
  console.log (err || data);
});

Installation

Normal: npm install brothermfc

Development: npm install fvdm/nodejs-brothermfc

Configuration

paramtyperequireddefaultdescription
hostnamestringyesPrinter hostname or IP
portnumberno80Printer web UI port
protocolstringnohttpPrinter web UI protocol, http or https
prefixstringnoPrinter web UI prefix
ippPortnumberno631Printer IPP service port
timeoutnumberno5000Web require time out in ms, 1000 = 1 sec

Example

var brother = require ('brothermfc') ({
  hostname: 'printer.lan',
  protocol: 'https'
});

current

( callback )

Get current information, like display text and ink levels, directly from the IPP interface. This is the most accurate information compared to the general.status method which is a calculation.

Note: this method may also work with other models and brands.

paramtyperequireddescription
callbackfunctionyessee Usage.

Example

brother.current (callback);

Output

{ state: 'idle',
  stateReasons: 'none',
  jobs: 0,
  uptime: 613845,
  uptimeDate: Tue Nov 18 2014 03:47:22 GMT+0100 (CET),
  ink: {
    magenta: 100,
    cyan: 100,
    yellow: 98,
    black: 86
  }
}
propertydescription
stateshort status message
stateReasonsmore descriptive status message
jobsprint tasks running and queued
uptimeseconds since last boot
uptimeDateDate object from uptime
inkinklevels in %, colors depend in model

general.status

( callback )

Get basic status details, like display text and ink levels.

Note: ink levels are less accurate then the .current method.

paramtyperequireddescription
callbackfunctionyessee Usage.

Example

brother.general.status (callback);

Output

{ model: 'MFC-J4710DW',
  status: 'moniOk',
  message: 'Gereed',
  ink: { magenta: 100, cyan: 100, yellow: 100, black: 91 },
  contact: 'Franklin',
  location: 'Here' }

general.information

( callback )

Get information specific to the device, i.e. IP-address and serialnumber.

paramtyperequireddescription
callbackfunctionyessee Usage.
brother.general.information (callback);

Output

{ node_name: 'BRA123BC456DE78',
  model_name: 'Brother MFC-J4710DW',
  location: 'Here',
  contact: 'Franklin',
  ip_address: '192.168.1.158',
  serial_no: 'A12345B678',
  firmware_version: 'H',
  page_counter: 26 }

general.sleep

( preset, callback )

Get or change the device's sleep timeout.

paramtyperequireddescription
presetnumbernoPreset number corresponding to minutes
callbackfunctionyessee Example

Get

brother.general.sleep (callback);

Output

{
  presets: {
    1: 2,
    2: 3,
    3: 5,
    4: 10,
    5: 30,
    6: 60
  ],
  value: {
    key: 4, minutes: 10
  }
}

The presets property are the predefined minutes you can choose from. The value property is the current setting.

Change

// set to key `5` = 30 minutes
brother.general.sleep (5, callback);

Output

  • OK: data is true (boolean)
  • Fail: err is Error: POST failed with err.error

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org

Author

Franklin van de Meent

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.2

9 years ago

0.2.0

9 years ago

0.1.0

10 years ago