@@ -0,0 +1,2268 @@
+/**%0A * Licensed to the Rhiot under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage io.rhiot.component.deviceio.i2c;%0A%0Aimport io.rhiot.component.deviceio.DeviceIOConstants;%0A%0Aimport java.util.Map;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0Aimport org.apache.camel.CamelContext;%0Aimport org.apache.camel.Endpoint;%0Aimport org.apache.camel.impl.UriEndpointComponent;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * Represents the component that manages %7B@link I2CEndpoint%7D.%0A */%0Apublic class I2CComponent extends UriEndpointComponent %7B%0A%0A    private static final transient Logger LOG = LoggerFactory.getLogger(I2CComponent.class);%0A%0A    public I2CComponent(CamelContext context, Class%3C? extends Endpoint%3E endpointClass) %7B%0A        super(context, endpointClass);%0A    %7D%0A%0A    @Override%0A    protected Endpoint createEndpoint(String uri, String remaining, Map%3CString, Object%3E parameters) throws Exception %7B%0A        Endpoint endpoint = null;%0A        Pattern regexPattern = Pattern.compile(DeviceIOConstants.CAMEL_I2C_URL_PATTERN);%0A%0A        Matcher match = regexPattern.matcher(remaining);%0A        if (match.matches()) %7B%0A%0A            int busId = Integer.decode(match.group(DeviceIOConstants.CAMEL_I2C_BUS_ID));%0A            int deviceId = Integer.decode(match.group(DeviceIOConstants.CAMEL_I2C_DEVICE_ID));%0A%0A            parameters.put(DeviceIOConstants.CAMEL_I2C_BUS_ID, busId);%0A            parameters.put(DeviceIOConstants.CAMEL_I2C_DEVICE_ID, deviceId);%0A%0A            setProperties(endpoint, parameters);%0A        %7D%0A%0A        return endpoint;%0A    %7D%0A%7D%0A

add deviceio i2c