Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can

Package Overview
Dependencies
Maintainers
1
Versions
301
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

build_docs.sh

105

can.js

@@ -28,7 +28,16 @@ /* Copyright Sebastian Haas <sebastian@sebastianhaas.info>. All rights reserved.

// Exports
/**
* @method createRawChannel
* @param channel {string} Channel name (e.g. vcan0)
* @return {RawChannel} a new channel object or exception
* @for exports
*/
exports.createRawChannel = function(channel, timestamps) { return new can.RawChannel(channel, timestamps); }
//-----------------------------------------------------------------------------
// Signal-Object
/**
* The Signals modules provides an interface to access the values/signals
* encoded in CAN messages.
* @module Signals
*/

@@ -39,4 +48,13 @@ var _signals = require('./build/Release/can_signals');

/**
* The actual signal.
* @class Signal
*/
function Signal(desc)
{
/**
* Symbolic name
* @attribute name
* @final
*/
this.name = desc['name'];

@@ -55,2 +73,7 @@

/**
* Current value
* @attribute value
* @final
*/
this.value = desc['defaultValue'];

@@ -63,3 +86,8 @@ if (!this.value)

// Keep track of listeners who want to be notified if this signal changes
/**
* Keep track of listeners who want to be notified if this signal changes
* @method onChange
* @param listener JS callback to get notification
* @for Signal
*/
Signal.prototype.onChange = function(listener) {

@@ -69,3 +97,10 @@ this.listeners.push(listener);

// Someone wants to change signals' value
/**
* Set new value of this signal. Any local registered clients will
* receive a notification. Please note, no CAN message is actually
* send to the bus (@see DatabaseServer::send)
* @method update
* @param newValue {bool|double|integer} New value to set
* @for Signal
*/
Signal.prototype.update = function(newValue) {

@@ -85,12 +120,41 @@ // Nothing changed

//-----------------------------------------------------------------------------
// Message-Object
/**
* Just a container to keep the Signals.
* @class Message
*/
function Message(desc)
{
/**
* CAN identifier
* @attribute id
* @final
*/
this.id = desc.id;
/**
* Extended Frame Format used
* @attribute ext
* @final
*/
this.ext = desc.ext;
/**
* Symbolic name
* @attribute name
* @final
*/
this.name = desc.name;
/**
* Length in bytes of resulting CAN message
* @attribute length
* @final
*/
this.length = desc.length;
/**
* Named array of signals within this message. Accessible via index and name.
* @attribute {Signal} signals
* @final
*/
this.signals = [];

@@ -105,6 +169,19 @@

//-----------------------------------------------------------------------------
// DatabaseService
/**
* A DatabaseService is usually generated once per bus to collect signals
* coded in the CAN messages according a DB description.
* @class DatabaseService
* @constructor DatabaseService
* @param channel RAW channel
* @param db_desc Set of rules to decode/encode signals (@parse_kcd.js)
* @return a new DatabaseService
* @for DatabaseService
*/
function DatabaseService(channel, db_desc) {
this.channel = channel;
/**
* Named array of known messages. Accessible via index and name.
* @attribute {Message} messages
*/
this.messages = [];

@@ -121,5 +198,7 @@

// Subscribe to any incoming messages
channel.addListener("onMessage", this.onMessage, this);
}
// Callback for incoming messages
DatabaseService.prototype.onMessage = function (msg) {

@@ -154,2 +233,9 @@ if (msg.rtr)

/**
* Construct a CAN message and encode all related signals according
* the rules. Finally send the message to the bus.
* @method send
* @param msg_name Name of the message to generate
* @for DatabaseService
*/
DatabaseService.prototype.send = function (msg_name) {

@@ -192,5 +278,10 @@ var m = this.messages[msg_name]

// Exports
/**
* @method parseNetworkDescription
* @param file {string} Path to KCD file to parse
* @return DB description to be used in DatabaseService
* @for exports
*/
exports.parseNetworkDescription = kcd.parseKcdFile;
exports.DatabaseService = DatabaseService;

2

package.json

@@ -8,3 +8,3 @@ {

"description": "A SocketCAN abstraction layer for NodeJS.",
"version": "1.2.2",
"version": "1.2.3",
"repository": {

@@ -11,0 +11,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc