Operation template codes implementation for subtypes

task-fixes
Thameera 10 months ago
parent fbbdd172e7
commit a600c69fdb

@ -18,12 +18,12 @@
package io.entgra.device.mgt.core.subtype.mgt.dao.impl; package io.entgra.device.mgt.core.subtype.mgt.dao.impl;
import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException;
import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException;
import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO;
import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import io.entgra.device.mgt.core.subtype.mgt.dao.util.DAOUtil; import io.entgra.device.mgt.core.subtype.mgt.dao.util.DAOUtil;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException;
import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -101,7 +101,9 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType) public DeviceSubType getDeviceSubType(String subTypeId, int tenantId, String deviceType)
throws SubTypeMgtDAOException { throws SubTypeMgtDAOException {
try { try {
String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE SUB_TYPE_ID = ? AND TENANT_ID = ? AND DEVICE_TYPE = ?"; String sql = "SELECT s.*, o.OPERATION_CODE FROM DM_DEVICE_SUB_TYPE s " +
"LEFT JOIN SUB_OPERATION_TEMPLATE o on s.SUB_TYPE_ID = o.SUB_TYPE_ID " +
"WHERE s.SUB_TYPE_ID = ? AND s.TENANT_ID = ? AND s.DEVICE_TYPE = ?";
Connection conn = ConnectionManagerUtil.getDBConnection(); Connection conn = ConnectionManagerUtil.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -109,10 +111,8 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
stmt.setString(3, deviceType); stmt.setString(3, deviceType);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) { List<DeviceSubType> deviceSubTypes = DAOUtil.loadDeviceSubTypes(rs);
return DAOUtil.loadDeviceSubType(rs); return (deviceSubTypes != null && !deviceSubTypes.isEmpty()) ? deviceSubTypes.get(0) : null;
}
return null;
} }
} }
@ -133,18 +133,20 @@ public class DeviceSubTypeDAOImpl implements DeviceSubTypeDAO {
public List<DeviceSubType> getAllDeviceSubTypes(int tenantId, String deviceType) public List<DeviceSubType> getAllDeviceSubTypes(int tenantId, String deviceType)
throws SubTypeMgtDAOException { throws SubTypeMgtDAOException {
try { try {
String sql = "SELECT * FROM DM_DEVICE_SUB_TYPE WHERE TENANT_ID = ? AND DEVICE_TYPE = ? ORDER BY " + String sql = "SELECT s.*, o.OPERATION_CODE FROM DM_DEVICE_SUB_TYPE s " +
"SUB_TYPE_ID"; "LEFT JOIN SUB_OPERATION_TEMPLATE o on s.SUB_TYPE_ID = o.SUB_TYPE_ID AND s.DEVICE_TYPE = o.DEVICE_TYPE " +
"WHERE s.TENANT_ID = ? AND s.DEVICE_TYPE = ? ORDER BY " +
"s.SUB_TYPE_ID";
Connection conn = ConnectionManagerUtil.getDBConnection(); Connection conn = ConnectionManagerUtil.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, deviceType); stmt.setString(2, deviceType);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
return DAOUtil.loadDeviceSubTypes(rs); List<DeviceSubType> deviceSubTypes = DAOUtil.loadDeviceSubTypes(rs);
return deviceSubTypes;
} }
} }
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = "Error occurred while obtaining DB connection to retrieve all device sub types for " + String msg = "Error occurred while obtaining DB connection to retrieve all device sub types for " +
deviceType + " subtypes"; deviceType + " subtypes";

@ -20,11 +20,12 @@ package io.entgra.device.mgt.core.subtype.mgt.dao.util;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class DAOUtil { public class DAOUtil {
@ -49,10 +50,35 @@ public class DAOUtil {
} }
public static List<DeviceSubType> loadDeviceSubTypes(ResultSet rs) throws SQLException { public static List<DeviceSubType> loadDeviceSubTypes(ResultSet rs) throws SQLException {
List<DeviceSubType> deviceSubTypes = new ArrayList<>(); try {
while (rs.next()) { Map<String, DeviceSubType> deviceSubTypes = new LinkedHashMap<>();
deviceSubTypes.add(loadDeviceSubType(rs)); DeviceSubType deviceSubType = new DeviceSubType() {
@Override
public <T> DeviceSubType convertToDeviceSubType() {
return null;
}
@Override
public String parseSubTypeToJson() throws JsonProcessingException {
return null;
}
};
while (rs.next()) {
String currentSubTypeId = rs.getString("SUB_TYPE_ID");
String deviceType = rs.getString("DEVICE_TYPE");
String operationCode = rs.getString("OPERATION_CODE");
String key = deviceType + "|" + currentSubTypeId;
if (!deviceSubTypes.containsKey(key)) {
deviceSubType = loadDeviceSubType(rs);
}
if (operationCode != null) {
deviceSubType.addOperationCode(operationCode);
}
deviceSubTypes.put(key, deviceSubType);
}
return new ArrayList<>(deviceSubTypes.values());
} catch (Exception e) {
return null;
} }
return deviceSubTypes;
} }
} }

@ -21,6 +21,9 @@ package io.entgra.device.mgt.core.subtype.mgt.dto;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.HashSet;
import java.util.Set;
public abstract class DeviceSubType { public abstract class DeviceSubType {
@ -29,16 +32,22 @@ public abstract class DeviceSubType {
private String deviceType; private String deviceType;
private String subTypeName; private String subTypeName;
private String typeDefinition; private String typeDefinition;
private Set<String> operationCodes = new HashSet<>();
public DeviceSubType() { public DeviceSubType() {
} }
public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition) { public DeviceSubType(String subTypeId, int tenantId, String deviceType, String subTypeName, String typeDefinition,
Set<String> operationCodes) {
this.subTypeId = subTypeId; this.subTypeId = subTypeId;
this.tenantId = tenantId; this.tenantId = tenantId;
this.deviceType = deviceType; this.deviceType = deviceType;
this.subTypeName = subTypeName; this.subTypeName = subTypeName;
this.typeDefinition = typeDefinition; this.typeDefinition = typeDefinition;
if (operationCodes != null || !operationCodes.isEmpty()) {
this.operationCodes.addAll(operationCodes);
}
} }
public String getSubTypeId() { public String getSubTypeId() {
@ -85,4 +94,10 @@ public abstract class DeviceSubType {
public abstract String parseSubTypeToJson() throws JsonProcessingException; public abstract String parseSubTypeToJson() throws JsonProcessingException;
public void addOperationCode(String code) {
operationCodes.add(code);
}
public Set<String> getOperationCodes() {
return operationCodes;
}
} }

@ -125,4 +125,19 @@ public class ServiceTest extends BaseDeviceSubTypePluginTest {
int subTypeCount = deviceSubTypeService.getDeviceSubTypeCount(deviceType); int subTypeCount = deviceSubTypeService.getDeviceSubTypeCount(deviceType);
log.info(deviceType + " Device subtypes count: " + subTypeCount); log.info(deviceType + " Device subtypes count: " + subTypeCount);
} }
@Test
public void testGetMeterDeviceType() throws SubTypeMgtPluginException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceSubType subTypeActual = deviceSubTypeService.getDeviceSubType("7", tenantId,
"METER");
Assert.assertNotNull(subTypeActual);
}
@Test
public void testGetAllMeterDeviceTypes() throws SubTypeMgtPluginException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceSubType> subTypeActual = deviceSubTypeService.getAllDeviceSubTypes(tenantId, "METER");
Assert.assertNotNull(subTypeActual);
}
} }

@ -26,7 +26,19 @@
`TYPE_DEFINITION` TEXT NOT NULL, `TYPE_DEFINITION` TEXT NOT NULL,
PRIMARY KEY (`SUB_TYPE_ID`,`DEVICE_TYPE`) PRIMARY KEY (`SUB_TYPE_ID`,`DEVICE_TYPE`)
); );
-- SUB_OPERATION_TEMPLATE TABLE--
CREATE TABLE SUB_OPERATION_TEMPLATE (
SUB_OPERATION_TEMPLATE_ID int NOT NULL AUTO_INCREMENT,
OPERATION_DEFINITION TEXT NOT NULL,
OPERATION_CODE varchar(100) NOT NULL,
SUB_TYPE_ID int NOT NULL,
DEVICE_TYPE VARCHAR(25) NOT NULL,
CREATE_TIMESTAMP timestamp NULL DEFAULT NULL,
UPDATE_TIMESTAMP timestamp NULL DEFAULT NULL,
PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID),
UNIQUE KEY SUB_OPERATION_TEMPLATE (SUB_TYPE_ID,OPERATION_CODE, DEVICE_TYPE),
CONSTRAINT fk_SUB_OPERATION_TEMPLATE_DM_DEVICE_SUB_TYPE FOREIGN KEY (SUB_TYPE_ID, DEVICE_TYPE) REFERENCES DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, DEVICE_TYPE)
);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Sample data for test cases -- Sample data for test cases
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -35,3 +47,898 @@ INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NA
(3,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 3, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}'), (3,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 3, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}'),
(4,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 4, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}'); (4,-1234,'Meter','TestSubType','{"make": "TestSubType", "model": "ATx-Mega SIM800", "subTypeId": 4, "hasSMSSupport": true, "hasICMPSupport": true, "socketServerPort": 8071}');
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'5', -1234, 'METER','Microstar - IEC Bulk',
'{
"compatibleComModules": {
"4": {
"subTypeId": 4,
"make": "Microstar",
"model": "IEC-GSM",
"socketServerPort": 5258,
"hasICMPSupport": true,
"hasSMSSupport": false,
"hasNMDSupport":false,
"tenantId": -1234
}
},
"compatibleComModulesIds": [4],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "1-0:0.0.0()",
"METER_FW_VER": "1-0:0.2.0()",
"TIME": "1-0:0.9.1()",
"DATE": "1-0:0.9.2()"
},
"userClientMapping": {
"0": 0,
"1": 1,
"2": 2
},
"make": "MicroStar",
"model": "IEC Bulk",
"serverAddress": 0,
"defaultClientAddress": 0,
"registerMapping": {
"0.0.0_0": {
"obis": "1-0:0.0.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_71.7.0": {
"obis": "1-1:71.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP": {
"obis": "P.01",
"attributeIndex": -1,
"classId": -1,
"isProfileRegister": true
},
"LP_3.8.0": {
"obis": "1-1:3.8.0",
"attributeIndex": -1,
"classId": -1
},
"LP_63.7.0": {
"obis": "1-1:73.7.0",
"attributeIndex": -1,
"classId": -1
},
"1.8.2_0": {
"obis": "1-1:1.8.2()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0*01_0": {
"obis": "1-1:2.8.0*1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.2*01_0": {
"obis": "1-1:1.8.2*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_72.7.0": {
"obis": "1-1:72.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"2.8.1_0": {
"obis": "1-1:2.8.1()",
"attributeIndex": -1,
"classId": -1
},
"0.9.2_0": {
"obis": "1-0:0.9.2()",
"attributeIndex": -1,
"classId": -1
},
"31.7.0_0": {
"obis": "1-1:31.7.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3_0": {
"obis": "1-1:2.8.3()",
"attributeIndex": -1,
"classId": -1
},
"51.7.0_0": {
"obis": "1-1:51.7.0()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0_0": {
"obis": "1-1:1.8.0()",
"attributeIndex": -1,
"classId": -1
},
"10.6.0*01_0": {
"obis": "1-1:10.6.0*1()",
"attributeIndex": -1,
"classId": -1
},
"71.7.0_0": {
"obis": "1-1:71.7.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.2*01_0": {
"obis": "1-1:2.8.2*1()",
"attributeIndex": -1,
"classId": -1
},
"72.7.0_0": {
"obis": "1-1:72.7.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_9.5.0": {
"obis": "1-1:9.4.0",
"attributeIndex": -1,
"classId": -1
},
"52.7.0_0": {
"obis": "1-1:52.7.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_13.7.0": {
"obis": "1-1:13.7.0",
"attributeIndex": -1,
"classId": -1
},
"LP_31.7.0": {
"obis": "1-1:31.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"0.4.3_0": {
"obis": "1-0:0.4.3()",
"attributeIndex": -1,
"classId": -1
},
"0.4.5_0": {
"obis": "1-0:0.4.5()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3*01_0": {
"obis": "1-1:1.8.3*1()",
"attributeIndex": -1,
"classId": -1
},
"32.7.0_0": {
"obis": "1-1:32.7.0()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0*01_0": {
"obis": "1-1:1.8.0*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_32.7.0": {
"obis": "1-1:32.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP_2.5.0": {
"obis": "1-1:2.4.0",
"attributeIndex": -1,
"classId": -1
},
"10.6.0_0": {
"obis": "1-1:10.6.0()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3*01_0": {
"obis": "1-1:2.8.3*1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3_0": {
"obis": "1-1:1.8.3()",
"attributeIndex": -1,
"classId": -1
},
"LP_33.7.0": {
"obis": "1-1:33.7.0",
"attributeIndex": -1,
"classId": -1
},
"0.9.1_0": {
"obis": "1-0:0.9.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0_0": {
"obis": "1-1:2.8.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_1.5.0": {
"obis": "1-1:1.4.0",
"attributeIndex": -1,
"classId": -1
},
"2.8.2_0": {
"obis": "1-1:2.8.2()",
"attributeIndex": -1,
"classId": -1
},
"1.8.1_0": {
"obis": "1-1:1.8.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_51.7.0": {
"obis": "1-1:51.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"LP_43.7.0": {
"obis": "1-1:53.7.0",
"attributeIndex": -1,
"classId": -1
},
"1.8.1*01_0": {
"obis": "1-1:1.8.1*1()",
"attributeIndex": -1,
"classId": -1
},
"9.6.0_0": {
"obis": "1-1:9.6.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_52.7.0": {
"obis": "1-1:52.7.0",
"attributeIndex": -1,
"classId": -1,
"scalingOption": "CUSTOM",
"scalar": 1000.0
},
"14.7.0_0": {
"obis": "1-1:14.7.0()",
"attributeIndex": -1,
"classId": -1
},
"9.6.0*01_0": {
"obis": "1-1:9.6.0*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_1.8.0": {
"obis": "1-1:1.8.0",
"attributeIndex": -1,
"classId": -1
},
"0.4.6_0": {
"obis": "1-0:0.4.6()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1*01_0": {
"obis": "1-1:2.8.1*1()",
"attributeIndex": -1,
"classId": -1
},
"LP_10.5.0": {
"obis": "1-1:10.4.0",
"attributeIndex": -1,
"classId": -1
},
"0.4.2_0": {
"obis": "1-0:0.4.2()",
"attributeIndex": -1,
"classId": -1
},
"LP_15.4.0": {
"obis": "1-1:15.4.0",
"attributeIndex": -1,
"classId": -1
},
"FW_VER": {
"obis": "1-0:0.2.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_2.8.0": {
"obis": "1-1:2.8.0",
"attributeIndex": -1,
"classId": -1
}
},
"transportProtocol": "IEC",
"defaultComModuleId": 4,
"defaultComModule": {
"subTypeId": 4,
"make": "Microstar",
"model": "IEC-GSM",
"socketServerPort": 5258,
"hasICMPSupport": true,
"hasSMSSupport": false,
"hasNMDSupport":false,
"tenantId": -1234
}
}'
);
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'6', -1234, 'METER', 'Anteleco - IEC 3Phase',
'{
"compatibleComModules": {
"1": {
"subTypeId": 1,
"make": "AnteLeco",
"model": "ATx-Mega SIM800",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
},
"8": {
"subTypeId": 8,
"make": "AnteLeco",
"model": "NB-IoT B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
},
"10": {
"subTypeId": 10,
"make": "AnteLeco",
"model": "ATx-Mega SIM800 B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
}
},
"compatibleComModulesIds": [1,8,10],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"REMOTE_RELAY_ON",
"REMOTE_RELAY_OFF",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "0.0.96.1.0.255()",
"METER_FW_VER": "1.0.0.2.0.255()",
"TIME": "1.0.0.9.1()",
"DATE": "1.0.0.9.2()"
},
"userClientMapping": {
"0": 0,
"1": 1,
"2": 2
},
"make": "Anteleco",
"model": "IEC 3Phase",
"serverAddress": 0,
"defaultClientAddress": 0,
"registerMapping": {
"0.0.0_0": {
"obis": "0.0.96.1.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_71.7.0": {
"obis": "71.7",
"attributeIndex": -1,
"classId": -1
},
"LP": {
"obis": "P.01",
"attributeIndex": -1,
"classId": -1,
"isProfileRegister": true
},
"CSRQ_RL": {
"obis": "0.0.96.128.1.0()",
"attributeIndex": -1,
"classId": -1
},
"LP_3.8.0": {
"obis": "3.8",
"attributeIndex": -1,
"classId": -1
},
"2.8.3*01_0": {
"obis": "1.0.2.8.3.1()",
"attributeIndex": -1,
"classId": -1
},
"1.8.3_0": {
"obis": "1.0.1.8.3.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_63.7.0": {
"obis": "63.5",
"attributeIndex": -1,
"classId": -1
},
"1.8.2_0": {
"obis": "1.0.1.8.2.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_33.7.0": {
"obis": "33.5",
"attributeIndex": -1,
"classId": -1
},
"0.9.1_0": {
"obis": "1.0.0.9.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0*01_0": {
"obis": "1.0.2.8.0.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.0_0": {
"obis": "1.0.2.8.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.2*01_0": {
"obis": "1.0.1.8.2.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_72.7.0": {
"obis": "72.7",
"attributeIndex": -1,
"classId": -1
},
"LP_1.5.0": {
"obis": "1.5",
"attributeIndex": -1,
"classId": -1
},
"2.8.2_0": {
"obis": "1.0.2.8.2.255()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1_0": {
"obis": "1.0.2.8.1.255()",
"attributeIndex": -1,
"classId": -1
},
"0.9.2_0": {
"obis": "1.0.0.9.2()",
"attributeIndex": -1,
"classId": -1
},
"31.7.0_0": {
"obis": "1.0.31.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"2.8.3_0": {
"obis": "1.0.2.8.3.255()",
"attributeIndex": -1,
"classId": -1
},
"51.7.0_0": {
"obis": "1.0.51.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.1_0": {
"obis": "1.0.1.8.1.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0_0": {
"obis": "1.0.1.8.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_51.7.0": {
"obis": "51.7",
"attributeIndex": -1,
"classId": -1
},
"LP_43.7.0": {
"obis": "43.5",
"attributeIndex": -1,
"classId": -1
},
"71.7.0_0": {
"obis": "1.0.71.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_4.8.0": {
"obis": "4.8",
"attributeIndex": -1,
"classId": -1
},
"1.8.1*01_0": {
"obis": "1.0.1.8.1.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.2*01_0": {
"obis": "1.0.2.8.2.1()",
"attributeIndex": -1,
"classId": -1
},
"72.7.0_0": {
"obis": "1.0.72.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_52.7.0": {
"obis": "52.7",
"attributeIndex": -1,
"classId": -1
},
"14.7.0_0": {
"obis": "1.0.14.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_9.5.0": {
"obis": "9.5",
"attributeIndex": -1,
"classId": -1
},
"LP_13.5.0": {
"obis": "13.5",
"attributeIndex": -1,
"classId": -1
},
"52.7.0_0": {
"obis": "1.0.52.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_31.7.0": {
"obis": "31.7",
"attributeIndex": -1,
"classId": -1
},
"LP_1.8.0": {
"obis": "1.8",
"attributeIndex": -1,
"classId": -1
},
"1.8.3*01_0": {
"obis": "1.0.1.8.3.1()",
"attributeIndex": -1,
"classId": -1
},
"32.7.0_0": {
"obis": "1.0.32.7.0.255()",
"attributeIndex": -1,
"classId": -1
},
"1.8.0*01_0": {
"obis": "1.0.1.8.0.1()",
"attributeIndex": -1,
"classId": -1
},
"2.8.1*01_0": {
"obis": "1.0.2.8.1.1()",
"attributeIndex": -1,
"classId": -1
},
"LP_10.5.0": {
"obis": "10.5",
"attributeIndex": -1,
"classId": -1
},
"LP_32.7.0": {
"obis": "32.7",
"attributeIndex": -1,
"classId": -1
},
"FW_VER": {
"obis": "1.0.0.2.0.255()",
"attributeIndex": -1,
"classId": -1
},
"LP_2.8.0": {
"obis": "2.8",
"attributeIndex": -1,
"classId": -1
},
"LP_2.5.0": {
"obis": "2.5",
"attributeIndex": -1,
"classId": -1
}
},
"transportProtocol": "IEC",
"defaultComModuleId": 10,
"defaultComModule": {
"subTypeId": 10,
"make": "AnteLeco",
"model": "ATx-Mega SIM800 B",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":false,
"tenantId": -1234
}
}'
);
INSERT INTO DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, TENANT_ID, DEVICE_TYPE, SUB_TYPE_NAME, TYPE_DEFINITION) VALUES (
'7', -1234, 'METER', 'Anteleco - NMD',
'{
"compatibleComModules": {
"5": {
"subTypeId": 5,
"make": "AnteLeco",
"model": "STM32 M65-NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
},
"9": {
"subTypeId": 9,
"make": "AnteLeco",
"model": "NB-IoT NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
}
},
"compatibleComModulesIds": [5,9],
"supportedOperations": [
"BILLING_REGISTERS_RETRIEVE",
"STATUS_RETRIEVE",
"TIME_SYNC",
"SELF_TEST",
"LOAD_PROFILE_RETRIEVE"
],
"defaultRegisters": {
"METER_ID": "0.0.96.1.0.255",
"METER_FW_VER": "1.0.0.2.0.255",
"CLOCK": "0.0.1.0.0.255"
},
"userClientMapping": {
"1": 2,
"2": 3,
"3": 4
},
"make": "Anteleco",
"model": "NMD",
"serverAddress": 1,
"defaultClientAddress": 16,
"registerMapping": {
"CO_128.0.12": {
"obis": "1.0.128.0.12.255",
"attributeIndex": 2,
"classId": 1
},
"0.0.0_0": {
"obis": "0.0.96.1.0.255",
"attributeIndex": 2,
"classId": 1
},
"CO_128.0.11": {
"obis": "1.0.128.0.11.255",
"attributeIndex": 2,
"classId": 1
},
"CO_128.32.0": {
"obis": "1.0.128.32.0.255",
"attributeIndex": 2,
"classId": 1
},
"LP": {
"obis": "1.0.99.1.1.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_128.36.0": {
"obis": "1.0.128.36.0.255",
"attributeIndex": 2,
"classId": 1
},
"CO_52.7.0": {
"obis": "1.0.52.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_96.50.22": {
"obis": "0.0.96.50.22.255",
"attributeIndex": 2,
"classId": 8
},
"CO_12.26.0": {
"obis": "1.0.12.26.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_96.50.21": {
"obis": "0.0.96.50.21.255",
"attributeIndex": 2,
"classId": 8
},
"0.9.0_0": {
"obis": "0.0.1.0.0.255",
"attributeIndex": 2,
"classId": 8
},
"C3DE": {
"obis": "0.0.99.98.10.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_128.0.10": {
"obis": "1.0.128.0.10.255",
"attributeIndex": 2,
"classId": 3
},
"C2DE": {
"obis": "0.0.99.98.9.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"C1DE": {
"obis": "0.0.99.98.8.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"CO_0.9.0_0": {
"obis": "0.0.1.0.0.255",
"attributeIndex": 2,
"classId": 8
},
"CO_72.128.0": {
"obis": "1.0.72.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_52.128.0": {
"obis": "1.0.52.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_32.128.0": {
"obis": "1.0.32.128.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_72.7.0": {
"obis": "1.0.72.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_128.40.0": {
"obis": "1.0.128.40.0.255",
"attributeIndex": 2,
"classId": 1
},
"72.7.0_0": {
"obis": "1.0.72.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"14.7.0_0": {
"obis": "1.0.14.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"52.7.0_0": {
"obis": "1.0.52.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_32.7.0": {
"obis": "1.0.32.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"32.7.0_0": {
"obis": "1.0.32.7.0.255",
"attributeIndex": 2,
"classId": 3
},
"CO_12.23.0": {
"obis": "1.0.12.23.0.255",
"attributeIndex": 2,
"classId": 3
},
"PFEL": {
"obis": "1.0.99.97.0.255",
"attributeIndex": 2,
"classId": 7,
"isProfileRegister": true
},
"FW_VER": {
"obis": "1.0.0.2.0.255",
"attributeIndex": 2,
"classId": 1
},
"96.6.0_0": {
"obis": "0.0.96.6.0.255",
"attributeIndex": 2,
"classId": 3
},
"96.6.3_0": {
"obis": "0.0.96.6.3.255",
"attributeIndex": 2,
"classId": 3
},
"96.6.3_1": {
"obis": "0.1.96.6.3.255",
"attributeIndex": 2,
"classId": 3
}
},
"transportProtocol": "DLMS",
"defaultComModuleId": 5,
"defaultComModule": {
"subTypeId": 5,
"make": "AnteLeco",
"model": "STM32 M65-NMD",
"socketServerPort": 8071,
"hasICMPSupport": true,
"hasSMSSupport": true,
"hasNMDSupport":true,
"tenantId": -1234
}
}'
);
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"BILLING_REGISTERS_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","9.6.0_0","9.6.0*01_0","10.6.0_0","10.6.0*01_0","0.4.2_0","0.4.3_0","0.4.5_0","0.4.6_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0"]}','BILLING_REGISTERS_RETRIEVE',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"LOAD_PROFILE_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["LP"]}','LOAD_PROFILE_RETRIEVE',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"TIME_SYNC","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"registerTransactions":[],"registers":["0.9.1_0","0.9.2_0"]}','TIME_SYNC',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"5","deviceType":"METER","code":"SELF_TEST","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","FW_VER","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","9.6.0_0","9.6.0*01_0","10.6.0_0","10.6.0*01_0","0.4.2_0","0.4.3_0","0.4.5_0","0.4.6_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0"]}','SELF_TEST',5,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"REMOTE_RELAY_ON","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[{"globalRegName":"CSRQ_RL","remoteMethod":{"index":2,"data":"003()","type":"STRING"}}],"registers":["0.9.1_0","0.9.2_0","CSRQ_RL","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0"]}','REMOTE_RELAY_ON',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"REMOTE_RELAY_OFF","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[{"globalRegName":"CSRQ_RL","remoteMethod":{"index":1,"data":"004()","type":"STRING"}}],"registers":["0.9.1_0","0.9.2_0","CSRQ_RL","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0"]}','REMOTE_RELAY_OFF',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"BILLING_REGISTERS_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"transportMode":"ALLOW_SMS_FALLBACK","registerTransactions":[],"registers":["0.0.0_0","0.9.1_0","0.9.2_0","1.8.0_0","1.8.1_0","1.8.2_0","1.8.3_0","2.8.0_0","2.8.1_0","2.8.2_0","2.8.3_0","1.8.0*01_0","1.8.1*01_0","1.8.2*01_0","1.8.3*01_0","2.8.0*01_0","2.8.1*01_0","2.8.2*01_0","2.8.3*01_0","14.7.0_0","31.7.0_0","32.7.0_0","51.7.0_0","52.7.0_0","71.7.0_0","72.7.0_0","CSRQ_RL"]}','BILLING_REGISTERS_RETRIEVE',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"LOAD_PROFILE_RETRIEVE","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateValidation":"3600000","requireAuthentication":"0"},"transportMode":"NET_ONLY","registerTransactions":[],"registers":["LP"]}','LOAD_PROFILE_RETRIEVE',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
INSERT INTO SUB_OPERATION_TEMPLATE(OPERATION_DEFINITION,OPERATION_CODE,SUB_TYPE_ID,DEVICE_TYPE,CREATE_TIMESTAMP,UPDATE_TIMESTAMP) VALUES('{"subTypeId":"6","deviceType":"METER","code":"TIME_SYNC","type":"PROFILE","control":"NO_REPEAT","maxAttempts":1,"waitingTime":0,"isEnabled":true,"properties":{"requireDateAdjust":"30000","requireAuthentication":"0"},"registerTransactions":[],"registers":["0.9.1_0","0.9.2_0"]}','TIME_SYNC',6,'METER',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
Loading…
Cancel
Save