Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ While code is divided in specific areas most ot it is present under `bundles` fo
** `org.connectorio.addons.binding` - common/shared code for binding.
** `org.connectorio.addons.binding.askoheat` - integration of Askoheat heaters (experimental).
** `org.connectorio.addons.binding.amsads` - implementation of ADS based integration for Beckhoff PLCs.
** `org.connectorio.addons.binding.can` - generic purpose CAN binding (experimental).
** `org.connectorio.addons.binding.bacnet` - communication with BACnet enabled HVAC equipment and other commercial real estate hardware.
** `org.connectorio.addons.binding.canbus` - generic purpose CAN bus binding (experimental).
** `org.connectorio.addons.binding.canopen` - integration of CANopen enabled deployments through SocketCAN.
** `org.connectorio.addons.binding.canopen.ta` - integration for https://ta.co.at[Technische Alternative] hardware (it is based on CANopen).
** `org.connectorio.addons.binding.plc4x` - integration with http://plc4x.apache.org[Apache PLC4X] project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ protected AdsChannelHandlerBase(Thing thing, ThingHandlerCallback callback, Chan
this.thing = thing;
this.callback = callback;
this.channel = channel;
this.refreshInterval = Optional.ofNullable(channel.getConfiguration())
this.refreshInterval = Optional.ofNullable(channel)
.map(Channel::getConfiguration)
.map(cfg -> cfg.get("refreshInterval"))
.map(val -> val instanceof Long ? (Long) val : Long.parseLong("" + val))
.orElse(null);
Expand Down

This file was deleted.

This file was deleted.

91 changes: 91 additions & 0 deletions bundles/org.connectorio.addons.binding.canbus/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2019-2021 ConnectorIO Sp. z o.o.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- SPDX-License-Identifier: Apache-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.connectorio.addons</groupId>
<artifactId>bundles</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>org.connectorio.addons.binding.canbus</artifactId>
<packaging>bundle</packaging>

<name>ConnectorIO - Addons - Binding - CAN bus</name>
<description>CAN bus integration.</description>

<dependencies>
<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.bittpl</artifactId>
</dependency>
<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.addons.network.can</artifactId>
</dependency>
<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.addons.binding.plc4x</artifactId>
</dependency>
<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.units</artifactId>
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-driver-can</artifactId>
</dependency>

<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.discovery</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
</dependency>

<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.addons.feature.plc4x</artifactId>
<classifier>features</classifier>
<type>xml</type>
</dependency>

<dependency>
<groupId>org.connectorio.addons</groupId>
<artifactId>org.connectorio.addons.binding.test</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023-2023 ConnectorIO sp. z o.o.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* https://www.gnu.org/licenses/gpl-3.0.txt
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package org.connectorio.addons.binding.canbus;


import java.util.Set;
import org.connectorio.addons.binding.BaseBindingConstants;
import org.openhab.core.thing.ThingTypeUID;

public interface CANbusBindingConstants extends BaseBindingConstants {

String BINDING_ID = BaseBindingConstants.identifier("canbus");

ThingTypeUID SOCKETCAN_BRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "socketcan");
ThingTypeUID MESSAGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "message");
Set<ThingTypeUID> SUPPORTED_THINGS = Set.of(SOCKETCAN_BRIDGE_THING_TYPE, MESSAGE_THING_TYPE);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.connectorio.addons.binding.canbus;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.function.Consumer;

public interface CanConnection {

CompletableFuture<Void> write(int cob, byte[] data);

// cancellable subscription
Future<Void> subscribe(int cob, Consumer<byte[]> callback);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.connectorio.addons.binding.canbus.config;

public class MessageConfiguration {

int cob;
String template;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.connectorio.addons.binding.canbus.config;

import org.connectorio.addons.binding.config.Configuration;

public class SocketCANConfiguration implements Configuration {

public String name;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.connectorio.addons.binding.canbus.config.channel;

public class BaseOffsetConfig implements OffsetConfig {

public int offset;

@Override
public int offset() {
return offset;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.connectorio.addons.binding.canbus.config.channel;

public class ByteChannelConfig extends BaseOffsetConfig implements LengthConfig {

public int length;

@Override
public int length() {
return length;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.connectorio.addons.binding.canbus.config.channel;

public class ContactChannelConfig extends BaseOffsetConfig {

String openValue;
String closedValue;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.connectorio.addons.binding.canbus.config.channel;

public interface LengthConfig {

int length();

}
Loading