diff --git a/.gitignore b/.gitignore index 8a16dd4..8e305b1 100644 --- a/.gitignore +++ b/.gitignore @@ -87,4 +87,6 @@ fabric.properties .idea/httpRequests # Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser \ No newline at end of file +.idea/caches/build_file_checksums.ser + +target diff --git a/decode-web-service.iml b/decode-web-service.iml index 76dc58e..13a9d17 100644 --- a/decode-web-service.iml +++ b/decode-web-service.iml @@ -25,22 +25,29 @@ - + - + + + + + + + + + - @@ -57,29 +64,18 @@ - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 902aa70..ed9fe74 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - net.irext.collector - spring-boot-mybatis + net.irext.decoder + irext-decode-service 0.0.1-SNAPSHOT jar - spring-boot-mybatis - Demo project for Spring Boot + IRext Decode Service + Decoding IR binaries online org.springframework.boot @@ -25,6 +25,10 @@ + + org.springframework.boot + spring-boot-starter-security + org.mybatis.spring.boot mybatis-spring-boot-starter @@ -34,16 +38,19 @@ org.springframework.boot spring-boot-starter-web - - - mysql - mysql-connector-java - runtime - org.springframework.boot - spring-boot-starter-test - test + spring-boot-starter-data-redis + + + org.springframework.session + spring-session + 1.3.4.RELEASE + + + org.springframework.data + spring-data-redis + 2.1.3.RELEASE diff --git a/src/main/java/net/irext/decoder/SpringBootMybatisApplication.java b/src/main/java/net/irext/decoder/IRDecoderApplication.java similarity index 76% rename from src/main/java/net/irext/decoder/SpringBootMybatisApplication.java rename to src/main/java/net/irext/decoder/IRDecoderApplication.java index cab851c..559e64c 100644 --- a/src/main/java/net/irext/decoder/SpringBootMybatisApplication.java +++ b/src/main/java/net/irext/decoder/IRDecoderApplication.java @@ -1,6 +1,5 @@ package net.irext.decoder; -import net.irext.decoder.model.CollectRemote; import org.apache.ibatis.type.MappedTypes; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; @@ -16,12 +15,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * Revision log: * 2018-12-08: created by strawmanbobi */ -@MappedTypes(CollectRemote.class) + @MapperScan("net.irext.decoder.mybatis.springbootmybatis.mapper") @SpringBootApplication -public class SpringBootMybatisApplication { +public class IRDecoderApplication { public static void main(String[] args) { - SpringApplication.run(SpringBootMybatisApplication.class, args); + SpringApplication.run(IRDecoderApplication.class, args); } + } diff --git a/src/main/java/net/irext/decoder/SessionConfig.java b/src/main/java/net/irext/decoder/SessionConfig.java new file mode 100644 index 0000000..bb05a8e --- /dev/null +++ b/src/main/java/net/irext/decoder/SessionConfig.java @@ -0,0 +1,16 @@ +package net.irext.decoder; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; + +@Configuration +@EnableRedisHttpSession +public class SessionConfig extends AbstractHttpSessionApplicationInitializer { + @Bean + public JedisConnectionFactory connectionFactory() { + return new JedisConnectionFactory(); + } +} diff --git a/src/main/java/net/irext/decoder/businesslogic/CollectCodeLogic.java b/src/main/java/net/irext/decoder/businesslogic/DecodeLogic.java similarity index 68% rename from src/main/java/net/irext/decoder/businesslogic/CollectCodeLogic.java rename to src/main/java/net/irext/decoder/businesslogic/DecodeLogic.java index e56e745..2ab5f9d 100644 --- a/src/main/java/net/irext/decoder/businesslogic/CollectCodeLogic.java +++ b/src/main/java/net/irext/decoder/businesslogic/DecodeLogic.java @@ -1,6 +1,5 @@ package net.irext.decoder.businesslogic; -import net.irext.decoder.model.IRCode; import org.springframework.stereotype.Controller; /** @@ -14,25 +13,25 @@ import org.springframework.stereotype.Controller; * 2018-12-08: created by strawmanbobi */ @Controller -public class CollectCodeLogic { +public class DecodeLogic { private Integer codeCollectState = 0; private IRCode irCode; - private static CollectCodeLogic collectCodeLogic; + private static DecodeLogic decodeLogic; - public static CollectCodeLogic getInstance(IRCode irCode) { - if (null == collectCodeLogic) { - collectCodeLogic = new CollectCodeLogic(irCode); + public static DecodeLogic getInstance(IRCode irCode) { + if (null == decodeLogic) { + decodeLogic = new DecodeLogic(irCode); } - return collectCodeLogic; + return decodeLogic; } - public CollectCodeLogic(IRCode irCode) { + public DecodeLogic(IRCode irCode) { this.irCode = irCode; } - public CollectCodeLogic() { + public DecodeLogic() { } diff --git a/src/main/java/net/irext/decoder/mapper/CollectRemoteMapper.java b/src/main/java/net/irext/decoder/mapper/CollectRemoteMapper.java deleted file mode 100644 index a61b867..0000000 --- a/src/main/java/net/irext/decoder/mapper/CollectRemoteMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.irext.decoder.mapper; - -import net.irext.decoder.model.CollectRemote; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.SelectKey; - -import java.util.List; - -/** - * Filename: CollectRemoteMapper.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: CollectRemote Mybatis Mapper - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -@Mapper -public interface CollectRemoteMapper { - - @Select("select * from collect_remote") - List listCollectRemotes(); - - @Insert("INSERT INTO collect_remote(category_id, category_name, brand_id, brand_name, city_code, city_name, " + - "operator_id, operator_name, remote_map, protocol, remote) " + - "values(#{categoryId}, #{categoryName}, #{brandId}, #{brandName}, #{cityCode}, #{cityName}, " + - "#{operatorId}, #{operatorName}, #{remoteMap}, #{protocol}, #{remote})") - @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", - before = false, resultType = Integer.class) - void createCollectRemote(CollectRemote collectRemote); -} diff --git a/src/main/java/net/irext/decoder/model/CollectKey.java b/src/main/java/net/irext/decoder/model/CollectKey.java deleted file mode 100644 index 99c2f29..0000000 --- a/src/main/java/net/irext/decoder/model/CollectKey.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.irext.decoder.model; - -/** - * Filename: CollectKey.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: CollectKey Model - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -public class CollectKey { - - private Integer id; - private Integer collectRemoteId; - private Integer keyId; - private String keyName; - private String keyValue; - - public CollectKey(Integer id, Integer collectRemoteId, Integer keyId, String keyName, String keyValue) { - this.id = id; - this.collectRemoteId = collectRemoteId; - this.keyId = keyId; - this.keyName = keyName; - this.keyValue = keyValue; - } - - public CollectKey() { - - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getCollectRemoteId() { - return collectRemoteId; - } - - public void setCollectRemoteId(Integer collectRemoteId) { - this.collectRemoteId = collectRemoteId; - } - - public Integer getKeyId() { - return keyId; - } - - public void setKeyId(Integer keyId) { - this.keyId = keyId; - } - - public String getKeyName() { - return keyName; - } - - public void setKeyName(String keyName) { - this.keyName = keyName; - } - - public String getKeyValue() { - return keyValue; - } - - public void setKeyValue(String keyValue) { - this.keyValue = keyValue; - } -} diff --git a/src/main/java/net/irext/decoder/model/CollectRemote.java b/src/main/java/net/irext/decoder/model/CollectRemote.java deleted file mode 100644 index 21217c0..0000000 --- a/src/main/java/net/irext/decoder/model/CollectRemote.java +++ /dev/null @@ -1,144 +0,0 @@ -package net.irext.decoder.model; - -/** - * Filename: CollectRemote.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: CollectRemote Model - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -public class CollectRemote { - - private Integer id; - private Integer categoryId; - private String categoryName; - private Integer brandId; - private String brandName; - private String cityCode; - private String cityName; - private Integer operatorId; - private String operatorName; - private String remoteMap; - private String protocol; - private String remote; - - public CollectRemote(Integer id, Integer categoryId, String categoryName, Integer brandId, String brandName, - String cityCode, String cityName, Integer operatorId, String operatorName, - String remoteMap, String protocol, String remote) { - this.id = id; - this.categoryId = categoryId; - this.categoryName = categoryName; - this.brandId = brandId; - this.brandName = brandName; - this.cityCode = cityCode; - this.cityName = cityName; - this.operatorId = operatorId; - this.operatorName = operatorName; - this.remoteMap = remoteMap; - this.protocol = protocol; - this.remote = remote; - } - - public CollectRemote() { - - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getCategoryId() { - return categoryId; - } - - public void setCategoryId(Integer categoryId) { - this.categoryId = categoryId; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public Integer getBrandId() { - return brandId; - } - - public void setBrandId(Integer brandId) { - this.brandId = brandId; - } - - public String getBrandName() { - return brandName; - } - - public void setBrandName(String brandName) { - this.brandName = brandName; - } - - public String getCityCode() { - return cityCode; - } - - public void setCityCode(String cityCode) { - this.cityCode = cityCode; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public Integer getOperatorId() { - return operatorId; - } - - public void setOperatorId(Integer operatorId) { - this.operatorId = operatorId; - } - - public String getOperatorName() { - return operatorName; - } - - public void setOperatorName(String operatorName) { - this.operatorName = operatorName; - } - - public String getRemoteMap() { - return remoteMap; - } - - public void setRemoteMap(String remoteMap) { - this.remoteMap = remoteMap; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getRemote() { - return remote; - } - - public void setRemote(String remote) { - this.remote = remote; - } -} diff --git a/src/main/java/net/irext/decoder/model/IRCode.java b/src/main/java/net/irext/decoder/model/IRCode.java deleted file mode 100644 index cc33a7f..0000000 --- a/src/main/java/net/irext/decoder/model/IRCode.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.irext.decoder.model; - -/** - * Filename: IRCode.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: IR Code - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -public class IRCode { - - private int id; - private String text; - private String key; - private String code; - - public IRCode(int id, String text, String key, String code) { - this.id = id; - this.text = text; - this.key = key; - this.code = code; - } - - public IRCode() { - - } - - public void setText(String text) { - this.text = text; - } - - public void setKey(String key) { - this.key = key; - } - - public void setCode(String code) { - this.code = code; - } - - public String getText() { - return this.text; - } - - public String getKey() { - return this.key; - } - - public String getCode() { - return this.code; - } -} diff --git a/src/main/java/net/irext/decoder/model/RemoteIndex.java b/src/main/java/net/irext/decoder/model/RemoteIndex.java new file mode 100644 index 0000000..04abaa3 --- /dev/null +++ b/src/main/java/net/irext/decoder/model/RemoteIndex.java @@ -0,0 +1,693 @@ +package net.irext.decoder.model; + +public class RemoteIndex { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.id + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Integer id; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.category_id + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Integer categoryId; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.category_name + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String categoryName; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.brand_id + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Integer brandId; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.brand_name + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String brandName; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.city_code + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String cityCode; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.city_name + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String cityName; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.operator_id + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String operatorId; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.operator_name + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String operatorName; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.protocol + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String protocol; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.remote + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String remote; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.remote_map + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String remoteMap; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.status + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Byte status; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.sub_cate + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Byte subCate; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.priority + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private Integer priority; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.remote_number + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String remoteNumber; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.operator_name_tw + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String operatorNameTw; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.category_name_tw + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String categoryNameTw; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.brand_name_tw + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String brandNameTw; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.city_name_tw + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String cityNameTw; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.binary_md5 + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String binaryMd5; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.contributor + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String contributor; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column remote_index.update_time + * + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + private String updateTime; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.id + * + * @return the value of remote_index.id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Integer getId() { + return id; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.id + * + * @param id the value for remote_index.id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.category_id + * + * @return the value of remote_index.category_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Integer getCategoryId() { + return categoryId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.category_id + * + * @param categoryId the value for remote_index.category_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCategoryId(Integer categoryId) { + this.categoryId = categoryId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.category_name + * + * @return the value of remote_index.category_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getCategoryName() { + return categoryName; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.category_name + * + * @param categoryName the value for remote_index.category_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.brand_id + * + * @return the value of remote_index.brand_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Integer getBrandId() { + return brandId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.brand_id + * + * @param brandId the value for remote_index.brand_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setBrandId(Integer brandId) { + this.brandId = brandId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.brand_name + * + * @return the value of remote_index.brand_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getBrandName() { + return brandName; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.brand_name + * + * @param brandName the value for remote_index.brand_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setBrandName(String brandName) { + this.brandName = brandName; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.city_code + * + * @return the value of remote_index.city_code + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getCityCode() { + return cityCode; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.city_code + * + * @param cityCode the value for remote_index.city_code + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.city_name + * + * @return the value of remote_index.city_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getCityName() { + return cityName; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.city_name + * + * @param cityName the value for remote_index.city_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCityName(String cityName) { + this.cityName = cityName; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.operator_id + * + * @return the value of remote_index.operator_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getOperatorId() { + return operatorId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.operator_id + * + * @param operatorId the value for remote_index.operator_id + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setOperatorId(String operatorId) { + this.operatorId = operatorId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.operator_name + * + * @return the value of remote_index.operator_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getOperatorName() { + return operatorName; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.operator_name + * + * @param operatorName the value for remote_index.operator_name + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setOperatorName(String operatorName) { + this.operatorName = operatorName; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.protocol + * + * @return the value of remote_index.protocol + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getProtocol() { + return protocol; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.protocol + * + * @param protocol the value for remote_index.protocol + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.remote + * + * @return the value of remote_index.remote + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getRemote() { + return remote; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.remote + * + * @param remote the value for remote_index.remote + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setRemote(String remote) { + this.remote = remote; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.remote_map + * + * @return the value of remote_index.remote_map + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getRemoteMap() { + return remoteMap; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.remote_map + * + * @param remoteMap the value for remote_index.remote_map + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setRemoteMap(String remoteMap) { + this.remoteMap = remoteMap; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.status + * + * @return the value of remote_index.status + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Byte getStatus() { + return status; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.status + * + * @param status the value for remote_index.status + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setStatus(Byte status) { + this.status = status; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.sub_cate + * + * @return the value of remote_index.sub_cate + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Byte getSubCate() { + return subCate; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.sub_cate + * + * @param subCate the value for remote_index.sub_cate + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setSubCate(Byte subCate) { + this.subCate = subCate; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.priority + * + * @return the value of remote_index.priority + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public Integer getPriority() { + return priority; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.priority + * + * @param priority the value for remote_index.priority + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setPriority(Integer priority) { + this.priority = priority; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.remote_number + * + * @return the value of remote_index.remote_number + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getRemoteNumber() { + return remoteNumber; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.remote_number + * + * @param remoteNumber the value for remote_index.remote_number + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setRemoteNumber(String remoteNumber) { + this.remoteNumber = remoteNumber; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.operator_name_tw + * + * @return the value of remote_index.operator_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getOperatorNameTw() { + return operatorNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.operator_name_tw + * + * @param operatorNameTw the value for remote_index.operator_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setOperatorNameTw(String operatorNameTw) { + this.operatorNameTw = operatorNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.category_name_tw + * + * @return the value of remote_index.category_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getCategoryNameTw() { + return categoryNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.category_name_tw + * + * @param categoryNameTw the value for remote_index.category_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCategoryNameTw(String categoryNameTw) { + this.categoryNameTw = categoryNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.brand_name_tw + * + * @return the value of remote_index.brand_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getBrandNameTw() { + return brandNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.brand_name_tw + * + * @param brandNameTw the value for remote_index.brand_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setBrandNameTw(String brandNameTw) { + this.brandNameTw = brandNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.city_name_tw + * + * @return the value of remote_index.city_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getCityNameTw() { + return cityNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.city_name_tw + * + * @param cityNameTw the value for remote_index.city_name_tw + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setCityNameTw(String cityNameTw) { + this.cityNameTw = cityNameTw; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.binary_md5 + * + * @return the value of remote_index.binary_md5 + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getBinaryMd5() { + return binaryMd5; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.binary_md5 + * + * @param binaryMd5 the value for remote_index.binary_md5 + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setBinaryMd5(String binaryMd5) { + this.binaryMd5 = binaryMd5; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.contributor + * + * @return the value of remote_index.contributor + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getContributor() { + return contributor; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.contributor + * + * @param contributor the value for remote_index.contributor + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setContributor(String contributor) { + this.contributor = contributor; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column remote_index.update_time + * + * @return the value of remote_index.update_time + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public String getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column remote_index.update_time + * + * @param updateTime the value for remote_index.update_time + * @mbggenerated Thu May 04 12:06:44 CST 2017 + */ + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } +} \ No newline at end of file diff --git a/src/main/java/net/irext/decoder/request/DecodeRequest.java b/src/main/java/net/irext/decoder/request/DecodeRequest.java new file mode 100644 index 0000000..85ff754 --- /dev/null +++ b/src/main/java/net/irext/decoder/request/DecodeRequest.java @@ -0,0 +1,64 @@ +package net.irext.decoder.request; + +import net.irext.decodesdk.bean.ACStatus; + +/** + * Filename: DecodeRequest.java + * Revised: Date: 2017-05-16 + * Revision: Revision: 1.0 + *

+ * Description: HTTP decode online + *

+ * Revision log: + * 2017-05-16: created by strawmanbobi + */ +public class DecodeRequest { + + private int indexId; + private ACStatus acStatus; + private int keyCode; + private int changeWindDir; + + public DecodeRequest(int indexId, ACStatus acStatus, int keyCode, int changeWindDir) { + this.indexId = indexId; + this.acStatus = acStatus; + this.keyCode = keyCode; + this.changeWindDir = changeWindDir; + } + + public DecodeRequest() { + + } + + public int getIndexId() { + return indexId; + } + + public void setIndexId(int indexId) { + this.indexId = indexId; + } + + public ACStatus getAcStatus() { + return acStatus; + } + + public void setAcStatus(ACStatus acStatus) { + this.acStatus = acStatus; + } + + public int getKeyCode() { + return keyCode; + } + + public void setKeyCode(int keyCode) { + this.keyCode = keyCode; + } + + public int getChangeWindDir() { + return changeWindDir; + } + + public void setChangeWindDir(int changeWindDir) { + this.changeWindDir = changeWindDir; + } +} diff --git a/src/main/java/net/irext/decoder/response/CollectKeysResponse.java b/src/main/java/net/irext/decoder/response/CollectKeysResponse.java deleted file mode 100644 index d3c208b..0000000 --- a/src/main/java/net/irext/decoder/response/CollectKeysResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.irext.decoder.response; - -import net.irext.decoder.model.CollectKey; - -import java.util.List; - -/** - * Filename: CollectKeysResponse.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: HTTP Response class - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -public class CollectKeysResponse extends ServiceResponse { - List entity; - - public CollectKeysResponse(Status status, List entity) { - super(status); - this.entity = entity; - } - - public CollectKeysResponse() { - - } - - public List getEntity() { - return entity; - } - - public void setEntity(List entity) { - this.entity = entity; - } -} \ No newline at end of file diff --git a/src/main/java/net/irext/decoder/response/CollectRemotesResponse.java b/src/main/java/net/irext/decoder/response/CollectRemotesResponse.java deleted file mode 100644 index 9ef472c..0000000 --- a/src/main/java/net/irext/decoder/response/CollectRemotesResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.irext.decoder.response; - -import net.irext.decoder.model.CollectRemote; - -import java.util.List; - -/** - * Filename: CollectRemotesResponse.java - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: HTTP Response class - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -public class CollectRemotesResponse extends ServiceResponse { - List entity; - - public CollectRemotesResponse(Status status, List entity) { - super(status); - this.entity = entity; - } - - public CollectRemotesResponse() { - - } - - public List getEntity() { - return entity; - } - - public void setEntity(List entity) { - this.entity = entity; - } -} diff --git a/src/main/java/net/irext/decoder/response/DecodeResponse.java b/src/main/java/net/irext/decoder/response/DecodeResponse.java new file mode 100644 index 0000000..5fa79c7 --- /dev/null +++ b/src/main/java/net/irext/decoder/response/DecodeResponse.java @@ -0,0 +1,34 @@ +package net.irext.decoder.response; + +/** + * Filename: DecodeResponse.java + * Revised: Date: 2017-05-16 + * Revision: Revision: 1.0 + *

+ * Description: Online decode response + *

+ * Revision log: + * 2017-05-16: created by strawmanbobi + */ +public class DecodeResponse extends ServiceResponse { + + private int[] entity; + + public DecodeResponse(Status status, int[] entity) { + super(status); + this.entity = entity; + } + + public DecodeResponse() { + + } + + public int[] getEntity() { + return entity; + } + + public void setEntity(int[] entity) { + this.entity = entity; + } +} + diff --git a/src/main/java/net/irext/decoder/service/CollectRemoteService.java b/src/main/java/net/irext/decoder/service/CollectRemoteService.java deleted file mode 100644 index d4be09a..0000000 --- a/src/main/java/net/irext/decoder/service/CollectRemoteService.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.irext.decoder.service; - -import net.irext.decoder.mapper.CollectRemoteMapper; -import net.irext.decoder.model.CollectRemote; -import net.irext.decoder.response.CollectRemotesResponse; -import net.irext.decoder.response.ServiceResponse; -import net.irext.decoder.response.Status; -import org.springframework.web.bind.annotation.*; - -/** - * Filename: CollectRemoteService - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: IRext Remote Management Service - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -@RestController -@RequestMapping("/irext/collect") -public class CollectRemoteService { - - private CollectRemoteMapper collectRemoteMapper; - - public CollectRemoteService(CollectRemoteMapper collectRemoteMapper) { - this.collectRemoteMapper = collectRemoteMapper; - } - - @GetMapping("/list_collect_remotes") - public CollectRemotesResponse listCollectRemotes() { - CollectRemotesResponse collectRemotesResponse = new CollectRemotesResponse(); - collectRemotesResponse.setEntity(collectRemoteMapper.listCollectRemotes()); - collectRemotesResponse.setStatus(new Status()); - return collectRemotesResponse; - } - - @PostMapping("/create_collect_remote") - private ServiceResponse createCollectRemote(@RequestBody CollectRemote collectRemote) { - - ServiceResponse serviceResponse = new ServiceResponse(); - collectRemoteMapper.createCollectRemote(collectRemote); - serviceResponse.setStatus(new Status()); - return serviceResponse; - } -} diff --git a/src/main/java/net/irext/decoder/service/IRCodeService.java b/src/main/java/net/irext/decoder/service/IRCodeService.java deleted file mode 100644 index c5d4b24..0000000 --- a/src/main/java/net/irext/decoder/service/IRCodeService.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.irext.decoder.service; - -import net.irext.decoder.businesslogic.CollectCodeLogic; -import net.irext.decoder.model.IRCode; -import net.irext.decoder.response.ServiceResponse; -import net.irext.decoder.response.Status; -import org.springframework.web.bind.annotation.*; - -/** - * Filename: IRCodeService - * Revised: Date: 2018-12-08 - * Revision: Revision: 1.0 - *

- * Description: IRext Code Collector Service - *

- * Revision log: - * 2018-12-08: created by strawmanbobi - */ -@RestController -@RequestMapping("/irext/collect") -public class IRCodeService { - - public IRCodeService() { - } - - @PostMapping("/collect_code") - public ServiceResponse collectCode(@RequestBody IRCode irCode) { - CollectCodeLogic.getInstance(irCode).collectCodeWorkUnit(); - ServiceResponse serviceResponse = new ServiceResponse(); - serviceResponse.setStatus(new Status()); - return serviceResponse; - } -} diff --git a/src/main/java/net/irext/decoder/service/IRDecodeService.java b/src/main/java/net/irext/decoder/service/IRDecodeService.java new file mode 100644 index 0000000..a857f0c --- /dev/null +++ b/src/main/java/net/irext/decoder/service/IRDecodeService.java @@ -0,0 +1,56 @@ +package net.irext.decoder.service; + +import net.irext.decoder.model.RemoteIndex; +import net.irext.decoder.request.DecodeRequest; +import net.irext.decoder.response.DecodeResponse; +import net.irext.decoder.response.Status; +import net.irext.decodesdk.bean.ACStatus; +import net.irext.decodesdk.utils.Constants; +import org.springframework.web.bind.annotation.*; + +/** + * Filename: IRDecodeService.java + * Revised: Date: 2018-12-16 + * Revision: Revision: 1.0 + *

+ * Description: IRext Decode WebService + *

+ * Revision log: + * 2018-12-16: created by strawmanbobi + */ +@RestController +@RequestMapping("/irext") +public class IRDecodeService { + + public IRDecodeService() { + + } + + @GetMapping("/decode") + public DecodeResponse irDecode(@RequestBody DecodeRequest decodeRequest) { + try { + int indexId = decodeRequest.getIndexId(); + ACStatus acstatus = decodeRequest.getAcStatus(); + int keyCode = decodeRequest.getKeyCode(); + int changeWindDir = decodeRequest.getChangeWindDir(); + + RemoteIndex index = indexingLogic.getRemoteIndex(indexId); + if (null == index) { + response.setEntity(null); + response.setStatus(new Status(Constants.ERROR_CODE_NETWORK_ERROR, "")); + return response; + } + + byte []binaryContent = operationLogic.prepareBinary(indexId); + System.out.println("binary content fetched : " + binaryContent.length); + int []decoded = operationLogic.decodeIR(index.getCategoryId(), index.getSubCate(), + binaryContent, acstatus, keyCode, changeWindDir); + response.setEntity(decoded); + + return response; + } catch (Exception e) { + e.printStackTrace(); + return getExceptionResponse(DecodeResponse.class); + } + } +} diff --git a/src/main/java/net/irext/decodesdk/IRDecode.java b/src/main/java/net/irext/decodesdk/IRDecode.java new file mode 100644 index 0000000..8f532e4 --- /dev/null +++ b/src/main/java/net/irext/decodesdk/IRDecode.java @@ -0,0 +1,121 @@ +package net.irext.decodesdk; + +import net.irext.decodesdk.bean.ACStatus; +import net.irext.decodesdk.bean.TemperatureRange; +import net.irext.decodesdk.utils.Constants; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.servlet.ServletContext; + +/** + * Filename: IRDecode.java + * Revised: Date: 2017-04-22 + * Revision: Revision: 1.0 + *

+ * Description: Wrapper-sdk of IR decode + *

+ * Revision log: + * 2017-04-23: created by strawmanbobi + */ +public class IRDecode { + + private static final String TAG = IRDecode.class.getSimpleName(); + + @Autowired + private static ServletContext context; + + private static Object mSync = new Object(); + + private native int irOpen(int category, int subCate, String fileName); + + private native int irOpenBinary(int category, int subCate, byte[] binaries, int binLength); + + private native int[] irDecode(int keyCode, ACStatus acStatus, int changeWindDirection); + + private native void irClose(); + + private native TemperatureRange irACGetTemperatureRange(int acMode); + + private native int irACGetSupportedMode(); + + private native int irACGetSupportedWindSpeed(int acMode); + + private native int irACGetSupportedSwing(int acMode); + + private static IRDecode mInstance; + + public static IRDecode getInstance() { + if (null == mInstance) { + mInstance = new IRDecode(); + } + return mInstance; + } + + private IRDecode() { + String libPath = "/data/irext/libirda_decoder.so"; + System.out.println("loading decode library " + libPath); + System.load(libPath); + } + + public int openFile(int category, int subCate, String fileName) { + return irOpen(category, subCate, fileName); + } + + public int openBinary(int category, int subCate, byte[] binaries, int binLength) { + return irOpenBinary(category, subCate, binaries, binLength); + } + + public int[] decodeBinary(int keyCode, ACStatus acStatus, int changeWindDir) { + int []decoded; + synchronized (mSync) { + if (null == acStatus) { + acStatus = new ACStatus(); + } + decoded = irDecode(keyCode, acStatus, changeWindDir); + } + return decoded; + } + + public void closeBinary() { + irClose(); + } + + public TemperatureRange getTemperatureRange(int acMode) { + return irACGetTemperatureRange(acMode); + } + + public int[] getACSupportedMode() { + // cool, heat, auto, fan, de-humidification + int []retSupportedMode = {0, 0, 0, 0, 0}; + int supportedMode = irACGetSupportedMode(); + for (int i = Constants.ACMode.MODE_COOL.getValue(); i <= + Constants.ACMode.MODE_DEHUMIDITY.getValue(); i++) { + retSupportedMode[i] = (supportedMode >>> 1) & 1; + } + return retSupportedMode; + } + + public int[] getACSupportedWindSpeed(int acMode) { + // auto, low, medium, high + int []retSupportedWindSpeed = {0, 0, 0, 0}; + int supportedWindSpeed = irACGetSupportedWindSpeed(acMode); + for (int i = Constants.ACWindSpeed.SPEED_AUTO.getValue(); + i <= Constants.ACWindSpeed.SPEED_HIGH.getValue(); + i++) { + retSupportedWindSpeed[i] = (supportedWindSpeed >>> 1) & 1; + } + return retSupportedWindSpeed; + } + + public int[] getACSupportedSwing(int acMode) { + // swing-on, swing-off + int []retSupportedSwing= {0, 0}; + int supportedSwing = irACGetSupportedSwing(acMode); + for (int i = Constants.ACSwing.SWING_ON.getValue(); + i <= Constants.ACSwing.SWING_OFF.getValue(); + i++) { + retSupportedSwing[i] = (supportedSwing >>> 1) & 1; + } + return retSupportedSwing; + } +} diff --git a/src/main/java/net/irext/decodesdk/bean/ACStatus.java b/src/main/java/net/irext/decodesdk/bean/ACStatus.java new file mode 100644 index 0000000..076fe5d --- /dev/null +++ b/src/main/java/net/irext/decodesdk/bean/ACStatus.java @@ -0,0 +1,115 @@ +package net.irext.decodesdk.bean; + +import net.irext.decodesdk.utils.Constants; + +/** + * Filename: ACStatus.java + * Revised: Date: 2017-03-28 + * Revision: Revision: 1.0 + *

+ * Description: Status descriptor for air-conditioner + *

+ * Revision log: + * 2017-03-28: created by strawmanbobi + */ +public class ACStatus { + + private static final String TAG = ACStatus.class.getSimpleName(); + + private int acPower; + private int acTemp; + private int acMode; + private int acWindDir; + private int acWindSpeed; + private int acDisplay; + private int acSleep; + private int acTimer; + + public ACStatus() { + this.acPower = Constants.ACPower.POWER_OFF.getValue(); + this.acMode = Constants.ACMode.MODE_AUTO.getValue(); + this.acTemp = Constants.ACTemperature.TEMP_24.getValue(); + this.acWindSpeed = Constants.ACWindSpeed.SPEED_AUTO.getValue(); + this.acWindDir = Constants.ACSwing.SWING_ON.getValue(); + this.acTimer = 0; + this.acDisplay = 0; + this.acSleep = 0; + } + + public ACStatus(int acPower, int acMode, int acTemp, int acWindSpeed, int acWindDir, + int acDisplay, int acSleep, int acTimer) { + this.acPower = acPower; + this.acTemp = acTemp; + this.acMode = acMode; + this.acWindDir = acWindDir; + this.acWindSpeed = acWindSpeed; + this.acDisplay = acDisplay; + this.acSleep = acSleep; + this.acTimer = acTimer; + } + + public int getAcPower() { + return acPower; + } + + public void setAcPower(int acPower) { + this.acPower = acPower; + } + + public int getAcTemp() { + return acTemp; + } + + public void setAcTemp(int acTemp) { + this.acTemp = acTemp; + } + + public int getAcMode() { + return acMode; + } + + public void setAcMode(int acMode) { + this.acMode = acMode; + } + + public int getAcWindDir() { + return acWindDir; + } + + public void setAcWindDir(int acWindDir) { + this.acWindDir = acWindDir; + } + + public int getAcWindSpeed() { + return acWindSpeed; + } + + public void setAcWindSpeed(int acWindSpeed) { + this.acWindSpeed = acWindSpeed; + } + + public int getAcDisplay() { + return acDisplay; + } + + public void setAcDisplay(int acDisplay) { + this.acDisplay = acDisplay; + } + + public int getAcSleep() { + return acSleep; + } + + public void setAcSleep(int acSleep) { + this.acSleep = acSleep; + } + + public int getAcTimer() { + return acTimer; + } + + public void setAcTimer(int acTimer) { + this.acTimer = acTimer; + } + +} diff --git a/src/main/java/net/irext/decodesdk/bean/TemperatureRange.java b/src/main/java/net/irext/decodesdk/bean/TemperatureRange.java new file mode 100644 index 0000000..00dd70a --- /dev/null +++ b/src/main/java/net/irext/decodesdk/bean/TemperatureRange.java @@ -0,0 +1,43 @@ +package net.irext.decodesdk.bean; + +/** + * Filename: TemperatureRange.java + * Revised: Date: 2017-03-28 + * Revision: Revision: 1.0 + *

+ * Description: Temperature range for air-conditioner + *

+ * Revision log: + * 2017-03-28: created by strawmanbobi + */ +public class TemperatureRange { + + private static final String TAG = TemperatureRange.class.getSimpleName(); + + private int tempMin; + private int tempMax; + + public TemperatureRange() { + } + + public TemperatureRange(int tempMin, int tempMax) { + this.tempMin = tempMin; + this.tempMax = tempMax; + } + + public int getTempMin() { + return tempMin; + } + + public void setTempMin(int tempMin) { + this.tempMin = tempMin; + } + + public int getTempMax() { + return tempMax; + } + + public void setTempMax(int tempMax) { + this.tempMax = tempMax; + } +} diff --git a/src/main/java/net/irext/decodesdk/libs/libirda_decoder.so b/src/main/java/net/irext/decodesdk/libs/libirda_decoder.so new file mode 100644 index 0000000..5215a19 Binary files /dev/null and b/src/main/java/net/irext/decodesdk/libs/libirda_decoder.so differ diff --git a/src/main/java/net/irext/decodesdk/utils/Constants.java b/src/main/java/net/irext/decodesdk/utils/Constants.java new file mode 100644 index 0000000..41d79a6 --- /dev/null +++ b/src/main/java/net/irext/decodesdk/utils/Constants.java @@ -0,0 +1,175 @@ +package net.irext.decodesdk.utils; + +/** + * Filename: Constants.java + * Revised: Date: 2017-04-03 + * Revision: Revision: 1.0 + *

+ * Description: SDK Constants + *

+ * Revision log: + * 2017-04-03: created by strawmanbobi + */ +public class Constants { + + public static final int ERROR_CODE_SUCCESS = 0; + public static final int ERROR_CODE_NETWORK_ERROR = -1; + public static final int ERROR_CODE_AUTH_FAILURE = 1; + public static final int ERROR_CODE_INVALID_CATEGORY = 2; + public static final int ERROR_CODE_INVALID_BRAND = 3; + public static final int ERROR_CODE_INVALID_PARAMETER = 4; + + public enum CategoryID { + AIR_CONDITIONER(1), + TV(2), + STB(3), + NET_BOX(4), + IPTV(5), + DVD(6), + FAN(7), + PROJECTOR(8), + STEREO(9), + LIGHT(10), + BSTB(11), + CLEANING_ROBOT(12), + AIR_CLEANER(13); + + private final int id; + + CategoryID(int id) { + this.id = id; + } + + public int getValue() { + return id; + } + } + + public enum BinaryType { + TYPE_BINARY(0), + TYPE_HEXDECIMAL(1); + + private final int type; + + BinaryType(int type) { + this.type = type; + } + + public int getValue() { + return type; + } + } + + public enum ACPower { + POWER_ON(0), + POWER_OFF(1); + + private final int power; + + ACPower(int power) { + this.power = power; + } + + public int getValue() { + return power; + } + } + + public enum ACMode { + MODE_COOL(0), + MODE_HEAT(1), + MODE_AUTO(2), + MODE_FAN(3), + MODE_DEHUMIDITY(4); + + private final int mode; + + ACMode(int mode) { + this.mode = mode; + } + + public int getValue() { + return mode; + } + } + + public enum ACTemperature { + TEMP_16(0), + TEMP_17(1), + TEMP_18(2), + TEMP_19(3), + TEMP_20(4), + TEMP_21(5), + TEMP_22(6), + TEMP_23(7), + TEMP_24(8), + TEMP_25(9), + TEMP_26(10), + TEMP_27(11), + TEMP_28(12), + TEMP_29(13), + TEMP_30(14); + + private final int temp; + + ACTemperature(int temp) { + this.temp = temp; + } + + public int getValue() { + return temp; + } + } + + public enum ACWindSpeed { + SPEED_AUTO(0), + SPEED_LOW(1), + SPEED_MEDIUM(2), + SPEED_HIGH(3); + + private final int speed; + + ACWindSpeed(int speed) { + this.speed = speed; + } + + public int getValue() { + return speed; + } + } + + public enum ACSwing { + SWING_ON(0), + SWING_OFF(1); + + private final int swing; + + ACSwing(int swing) { + this.swing = swing; + } + + public int getValue() { + return swing; + } + } + + public enum ACFunction { + FUNCTION_SWITCH_POWER(1), + FUNCTION_CHANGE_MODE(2), + FUNCTION_TEMPERATURE_UP(3), + FUNCTION_TEMPERATURE_DOWN(4), + FUNCTION_SWITCH_WIND_SPEED(5), + FUNCTION_SWITCH_WIND_DIR(6), + FUNCTION_SWITCH_SWING(7); + + private final int function; + + ACFunction(int function) { + this.function = function; + } + + public int getValue() { + return function; + } + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 66ca309..eaa4811 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,4 @@ -server.port=8081 +server.port=8082 -spring.datasource.url=jdbc:mysql://localhost:3306/irext_collect -spring.datasource.username=root -spring.datasource.password=root +spring.redis.host=localhost +spring.redis.port=6379 \ No newline at end of file