136 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			136 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/****************************************************************************
 | 
						|
 | 
						|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | 
						|
 | 
						|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | 
						|
be copied by any method or incorporated into another program without
 | 
						|
the express written consent of Aerospace C.Power. This Information or any portion
 | 
						|
thereof remains the property of Aerospace C.Power. The Information contained herein
 | 
						|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | 
						|
liability for its use in any way and conveys no license or title under
 | 
						|
any patent or copyright and makes no representation or warranty that this
 | 
						|
Information is free from patent or copyright infringement.
 | 
						|
 | 
						|
****************************************************************************/
 | 
						|
#ifndef IOT_SG_PROTO_H
 | 
						|
#define IOT_SG_PROTO_H
 | 
						|
 | 
						|
/* meter proto base on 3762 proto value
 | 
						|
 * these value must be same as defined in 3762 protocol without any modification
 | 
						|
 * transparent transmission
 | 
						|
 */
 | 
						|
#define PROTO_TYPE_RAW_DATA                     (0x00)
 | 
						|
/* 645 protocol, version 1997 */
 | 
						|
#define PROTO_TYPE_645_1997                     (0x01)
 | 
						|
/* 645 protocol, version 2007 */
 | 
						|
#define PROTO_TYPE_645_2007                     (0x02)
 | 
						|
/* 698.45 protocol */
 | 
						|
#define PROTO_TYPE_698_45                       (0x03)
 | 
						|
/* power down and power up event */
 | 
						|
#define PROTO_TYPE_POWER_EVT                    (0x04)
 | 
						|
/* transformer change event */
 | 
						|
#define PROTO_TYPE_TSFM_CHG_EVT                 (0x05)
 | 
						|
/* report model water meter */
 | 
						|
#define PROTO_TYPE_RPT_MOD_WM                   (0x04)
 | 
						|
/* real-time meter reading model water meter */
 | 
						|
#define PROTO_TYPE_MR_MOD_WM                    (0x05)
 | 
						|
/* gas meter */
 | 
						|
#define PROTO_TYPE_GAS_METER                    (0x06)
 | 
						|
/* abnormal electric current report */
 | 
						|
#define PROTO_TYPE_NLI_ABNORMAL                 (0x06)
 | 
						|
/* heat meter */
 | 
						|
#define PROTO_TYPE_HEAT_METER                   (0x07)
 | 
						|
/* CJ/T188 protocol */
 | 
						|
#define PROTO_TYPE_CJ_T188                      (0x80)
 | 
						|
/* 698.45 transparent 698.45 */
 | 
						|
#define PROTO_TYPE_698_BY_698                   (0xFB)
 | 
						|
/* 376.1 transparent 698.45 */
 | 
						|
#define PROTO_TYPE_698_BY_3761                  (0xFC)
 | 
						|
/* 698.45 transparent 645-2007 */
 | 
						|
#define PROTO_TYPE_645_2007_BY_698              (0xFD)
 | 
						|
/* 376.1 transparent 645-2007 */
 | 
						|
#define PROTO_TYPE_645_2007_BY_3761             (0xFE)
 | 
						|
/* reserved */
 | 
						|
#define PROTO_TYPE_RSVD                         (0xFF)
 | 
						|
 | 
						|
/* framework element identity */
 | 
						|
/* vendor id */
 | 
						|
#define IOT_SG_ELEMENT_STA_VENDOR_ID            (0x00)
 | 
						|
/* version id */
 | 
						|
#define IOT_SG_ELEMENT_STA_VERSION_ID           (0x01)
 | 
						|
/* version date */
 | 
						|
#define IOT_SG_ELEMENT_STA_VERSION_DATE         (0x02)
 | 
						|
/* upgrade crc value */
 | 
						|
#define IOT_SG_ELEMENT_STA_UPGRADE_CRC          (0x03)
 | 
						|
/* manufacute msg */
 | 
						|
#define IOT_SG_ELEMENT_STA_MANUFACTURE          (0x04)
 | 
						|
/* bootload version */
 | 
						|
#define IOT_SG_ELEMENT_STA_BOOTLOAD_ID          (0x05)
 | 
						|
/* length of the upgrade file */
 | 
						|
#define IOT_SG_ELEMENT_STA_UPGRADE_LEN          (0x06)
 | 
						|
/* device type */
 | 
						|
#define IOT_SG_ELEMENT_STA_DEVICE_TYPE          (0x07)
 | 
						|
/* chip code */
 | 
						|
#define IOT_SG_ELEMENT_STA_CHIP_CODE            (0x08)
 | 
						|
/* property info */
 | 
						|
#define IOT_SG_ELEMENT_STA_PROP_INFO            (0x09)
 | 
						|
/* upgrade result status words */
 | 
						|
#define IOT_SG_ELEMENT_STA_UPGRADE_WORDS        (0x0A)
 | 
						|
/* module mac addr or module id */
 | 
						|
#define IOT_SG_ELEMENT_STA_MOD_MAC              (0x0B)
 | 
						|
/* module hardware version id */
 | 
						|
#define IOT_SG_ELEMENT_STA_HW_MOD_VER_INFO      (0x0C)
 | 
						|
/* module hardware version date */
 | 
						|
#define IOT_SG_ELEMENT_STA_HW_MOD_DATE          (0x0D)
 | 
						|
/* chip software version id */
 | 
						|
#define IOT_SG_ELEMENT_STA_SW_CHIP_VER_INFO     (0x0E)
 | 
						|
/* chip software version date */
 | 
						|
#define IOT_SG_ELEMENT_STA_SW_CHIP_VER_DATE     (0x0F)
 | 
						|
/* chip hardware version id */
 | 
						|
#define IOT_SG_ELEMENT_STA_HW_CHIP_VER_INFO     (0x10)
 | 
						|
/* chip hardware version date */
 | 
						|
#define IOT_SG_ELEMENT_STA_HW_CHIP_VER_DATE     (0x11)
 | 
						|
/* application version id */
 | 
						|
#define IOT_SG_ELEMENT_STA_APP_VER_INFO         (0x12)
 | 
						|
/* module device id */
 | 
						|
#define IOT_SG_ELEMENT_STA_DEV_ID               (0x13)
 | 
						|
/* element identity invalid */
 | 
						|
#define IOT_SG_ELEMENT_STA_INVALID              (0xFF)
 | 
						|
 | 
						|
/* all element has been queried except for the upgrade */
 | 
						|
#define IOT_SG_ELEMENT_QUERY_COMPLETED \
 | 
						|
                                ((1 << IOT_SG_ELEMENT_STA_VENDOR_ID)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_VERSION_ID)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_BOOTLOAD_ID)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_CHIP_CODE)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_VERSION_DATE)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_MOD_MAC)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_HW_MOD_VER_INFO)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_HW_MOD_DATE)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_SW_CHIP_VER_INFO)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_SW_CHIP_VER_DATE)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_HW_CHIP_VER_INFO)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_HW_CHIP_VER_DATE)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_APP_VER_INFO)\
 | 
						|
                                | (1 << IOT_SG_ELEMENT_STA_DEV_ID))
 | 
						|
 | 
						|
/* framework upgrade file attribute */
 | 
						|
#define IOT_SG_FILE_TYPE_CCO                    (0)
 | 
						|
#define IOT_SG_FILE_TYPE_STA                    (1)
 | 
						|
#define IOT_SG_FILE_TYPE_COLLECT                (2)
 | 
						|
#define IOT_SG_FILE_TYPE_PM                     (4)
 | 
						|
#define IOT_SG_FILE_TYPE_CLR                    (32)
 | 
						|
#define IOT_SG_FILE_TYPE_INVALID                (0xFFFF)
 | 
						|
 | 
						|
/* upgrading state for cctt to query */
 | 
						|
#define IOT_SG_CCO_UPGRADE_ST_IDLE              (0)
 | 
						|
#define IOT_SG_CCO_UPGRADE_ST_RUNING            (1)
 | 
						|
#define IOT_SG_CCO_UPGRADE_ST_DONE              (2)
 | 
						|
 | 
						|
/* transmission port */
 | 
						|
#define PROTO_PORT_RS485_1                      (1)
 | 
						|
#define PROTO_PORT_RS485_2                      (2)
 | 
						|
 | 
						|
#endif /* IOT_SG_PROTO_H */
 | 
						|
 |