Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
e5cd9e56
Commit
e5cd9e56
authored
Sep 30, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2020 0930
parent
e5950adc
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
2279 additions
and
2234 deletions
+2279
-2234
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+3
-0
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+1
-1
platform/zigbee/platform/base/hal/micro/unix/host/micro.c
platform/zigbee/platform/base/hal/micro/unix/host/micro.c
+3
-3
platform/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.c
...rm/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.c
+173
-172
platform/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.h
...rm/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.h
+25
-25
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-io.c
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-io.c
+1
-0
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-ui.c
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-ui.c
+14
-14
platform/zigbee/protocol/zigbee/app/framework/include/af-types.h
...m/zigbee/protocol/zigbee/app/framework/include/af-types.h
+61
-61
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/backchannel-support.c
...e/app/framework/plugin-host/gateway/backchannel-support.c
+122
-122
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/gateway-support.c
...igbee/app/framework/plugin-host/gateway/gateway-support.c
+30
-30
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/gateway-support.h
...igbee/app/framework/plugin-host/gateway/gateway-support.h
+4
-4
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-common/ota-cli.h
...protocol/zigbee/app/framework/plugin/ota-common/ota-cli.h
+1
-1
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-common/ota-common.c
...tocol/zigbee/app/framework/plugin/ota-common/ota-common.c
+9
-9
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server-policy/ota-server-policy.c
...pp/framework/plugin/ota-server-policy/ota-server-policy.c
+202
-197
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-cli.c
...l/zigbee/app/framework/plugin/ota-server/ota-server-cli.c
+2
-2
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-dynamic-block-period.c
...ework/plugin/ota-server/ota-server-dynamic-block-period.c
+7
-7
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-page-request.c
...app/framework/plugin/ota-server/ota-server-page-request.c
+4
-4
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server.c
...tocol/zigbee/app/framework/plugin/ota-server/ota-server.c
+399
-352
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage-common-cli.c
...mework/plugin/ota-storage-common/ota-storage-common-cli.c
+2
-2
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage-common.c
.../framework/plugin/ota-storage-common/ota-storage-common.c
+15
-15
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage.h
...bee/app/framework/plugin/ota-storage-common/ota-storage.h
+9
-9
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-posix-filesystem/ota-storage-linux.c
...k/plugin/ota-storage-posix-filesystem/ota-storage-linux.c
+1033
-1041
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-posix-filesystem/ota-storage-linux.h
...k/plugin/ota-storage-posix-filesystem/ota-storage-linux.h
+6
-6
platform/zigbee/protocol/zigbee/app/framework/security/af-security-common.c
...otocol/zigbee/app/framework/security/af-security-common.c
+1
-1
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
.../zigbee/protocol/zigbee/app/framework/util/af-main-host.c
+5
-9
platform/zigbee/protocol/zigbee/app/framework/util/client-api.c
...rm/zigbee/protocol/zigbee/app/framework/util/client-api.c
+2
-2
platform/zigbee/protocol/zigbee/app/framework/util/process-cluster-message.c
...tocol/zigbee/app/framework/util/process-cluster-message.c
+5
-5
platform/zigbee/protocol/zigbee/app/framework/util/util.c
platform/zigbee/protocol/zigbee/app/framework/util/util.c
+1
-1
platform/zigbee/protocol/zigbee/app/util/serial/linux-serial.c
...orm/zigbee/protocol/zigbee/app/util/serial/linux-serial.c
+139
-139
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
e5cd9e56
...
@@ -156,6 +156,9 @@ void emberAfPluginDeviceTableDeviceLeftCallback(EmberEUI64 nodeEui64)
...
@@ -156,6 +156,9 @@ void emberAfPluginDeviceTableDeviceLeftCallback(EmberEUI64 nodeEui64)
rpc_printfJSON
(
"left"
,
nodeJson
);
rpc_printfJSON
(
"left"
,
nodeJson
);
kk_msg_report_dev_leave
(
deviceTable
[
deviceTableIndex
].
eui64
);
kk_msg_report_dev_leave
(
deviceTable
[
deviceTableIndex
].
eui64
);
kk_device_table_delete
(
deviceTable
[
deviceTableIndex
].
eui64
);
kk_device_db_delete
(
deviceTable
[
deviceTableIndex
].
eui64
);
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
e5cd9e56
...
@@ -266,7 +266,7 @@ int _init_param(struct jrpc_server *server) {
...
@@ -266,7 +266,7 @@ int _init_param(struct jrpc_server *server) {
//kk_zlog_init("paltform");
//kk_zlog_init("paltform");
printf
(
"getenv
\r\n
"
);
printf
(
"getenv
\r\n
"
);
char
*
debug_level_env
=
getenv
(
"
HOME
"
);
char
*
debug_level_env
=
getenv
(
"
JRPC_DEBUG
"
);
printf
(
"getenv(JRPC_DEBUG):%s
\n
"
,
server
->
debug_level
);
printf
(
"getenv(JRPC_DEBUG):%s
\n
"
,
server
->
debug_level
);
if
(
debug_level_env
==
NULL
)
if
(
debug_level_env
==
NULL
)
server
->
debug_level
=
0
;
server
->
debug_level
=
0
;
...
...
platform/zigbee/platform/base/hal/micro/unix/host/micro.c
View file @
e5cd9e56
...
@@ -47,13 +47,13 @@ void halReboot(void)
...
@@ -47,13 +47,13 @@ void halReboot(void)
uint8_t
halGetResetInfo
(
void
)
uint8_t
halGetResetInfo
(
void
)
{
{
return
RESET_SOFTWARE
;
return
RESET_SOFTWARE
;
}
}
PGM_P
halGetResetString
(
void
)
PGM_P
halGetResetString
(
void
)
{
{
static
PGM_P
resetString
=
"SOFTWARE"
;
static
PGM_P
resetString
=
"SOFTWARE"
;
return
(
resetString
);
return
(
resetString
);
}
}
// Ideally this should not be necessary, but the serial code references
// Ideally this should not be necessary, but the serial code references
...
...
platform/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
platform/zigbee/protocol/zigbee/app/ezsp-host/ash/ash-host-ui.h
View file @
e5cd9e56
...
@@ -31,31 +31,31 @@ void ashPrintCounters(AshCount *counters, bool clear);
...
@@ -31,31 +31,31 @@ void ashPrintCounters(AshCount *counters, bool clear);
void
ashClearCounters
(
AshCount
*
counters
);
void
ashClearCounters
(
AshCount
*
counters
);
static
const
char
usage
[]
=
static
const
char
usage
[]
=
" {ncp type} {options}
\n
"
" {ncp type} {options}
\n
"
" ncp type:
\n
"
" ncp type:
\n
"
" -n 0,1 0=EM2xx/EM3xx @ 115200 bps, RTS/CTS
\n
"
" -n 0,1 0=EM2xx/EM3xx @ 115200 bps, RTS/CTS
\n
"
" 1=EM2xx/EM3xx @ 57600 bps, XON/XOFF
\n
"
" 1=EM2xx/EM3xx @ 57600 bps, XON/XOFF
\n
"
" (if present must be the first option)
\n
"
" (if present must be the first option)
\n
"
" options:
\n
"
" options:
\n
"
" -b <baud rate> 9600, 19200, 38400, 57600, 115200, etc.
\n
"
" -b <baud rate> 9600, 19200, 38400, 57600, 115200, etc.
\n
"
" -f r,x flow control: r=RST/CTS, x=XON/XOFF
\n
"
" -f r,x flow control: r=RST/CTS, x=XON/XOFF
\n
"
" -h display usage information
\n
"
" -h display usage information
\n
"
" -i 0,1 enable/disable input buffering
\n
"
" -i 0,1 enable/disable input buffering
\n
"
" -o 0,1 enable/disable output buffering
\n
"
" -o 0,1 enable/disable output buffering
\n
"
" -p <port> serial port name or number (eg, COM1, ttyS0, or 1)
\n
"
" -p <port> serial port name or number (eg, COM1, ttyS0, or 1)
\n
"
" -r d,r,c ncp reset method: d=DTR, r=RST frame, c=custom
\n
"
" -r d,r,c ncp reset method: d=DTR, r=RST frame, c=custom
\n
"
" -s 1,2 stop bits
\n
"
" -s 1,2 stop bits
\n
"
" -t <trace flags> trace B0=frames, B1=verbose frames, B2=events, B3=EZSP
\n
"
" -t <trace flags> trace B0=frames, B1=verbose frames, B2=events, B3=EZSP
\n
"
" -v[base-port] enables virtual ISA support. The [base-port] argument
\n
"
" -v[base-port] enables virtual ISA support. The [base-port] argument
\n
"
" is optional. Both serial ports are available via telnet
\n
"
" is optional. Both serial ports are available via telnet
\n
"
" instead of local console. RAW serial port is available
\n
"
" instead of local console. RAW serial port is available
\n
"
" on the first port (offset 0 from base port), and CLI is
\n
"
" on the first port (offset 0 from base port), and CLI is
\n
"
" available on the second port (offset 1 from base port).
\n
"
" available on the second port (offset 1 from base port).
\n
"
" By default, 4900 is the base-port, therefore RAW access
\n
"
" By default, 4900 is the base-port, therefore RAW access
\n
"
" is available from port 4900, and CLI access is available
\n
"
" is available from port 4900, and CLI access is available
\n
"
" on port 4901.
\n
"
" on port 4901.
\n
"
" NOTE: No space is allowed between '-v' and [base-port].
\n
"
" NOTE: No space is allowed between '-v' and [base-port].
\n
"
" -x 0,1 enable/disable data randomization
\n
"
;
" -x 0,1 enable/disable data randomization
\n
"
;
static
const
AshCount
zeroAshCount
=
{
0
};
static
const
AshCount
zeroAshCount
=
{
0
};
...
...
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-io.c
View file @
e5cd9e56
...
@@ -559,6 +559,7 @@ bool ezspSerialPortRegisterCallback(EzspSerialPortCallbackFunction callback)
...
@@ -559,6 +559,7 @@ bool ezspSerialPortRegisterCallback(EzspSerialPortCallbackFunction callback)
void
ezspSerialWriteByte
(
uint8_t
byte
)
void
ezspSerialWriteByte
(
uint8_t
byte
)
{
{
BUMP_HOST_COUNTER
(
txBytes
);
BUMP_HOST_COUNTER
(
txBytes
);
#ifdef IO_LOG
#ifdef IO_LOG
{
{
...
...
platform/zigbee/protocol/zigbee/app/ezsp-host/ezsp-host-ui.c
View file @
e5cd9e56
...
@@ -66,10 +66,10 @@
...
@@ -66,10 +66,10 @@
void
ezspPrintUsage
(
char
*
name
)
void
ezspPrintUsage
(
char
*
name
)
{
{
char
*
shortName
=
strrchr
(
name
,
'/'
);
char
*
shortName
=
strrchr
(
name
,
'/'
);
shortName
=
shortName
?
shortName
+
1
:
name
;
shortName
=
shortName
?
shortName
+
1
:
name
;
fprintf
(
stderr
,
"Usage: %s"
,
shortName
);
fprintf
(
stderr
,
"Usage: %s"
,
shortName
);
fprintf
(
stderr
,
usage
);
fprintf
(
stderr
,
usage
);
}
}
#ifdef __CYGWIN__
#ifdef __CYGWIN__
...
@@ -103,16 +103,16 @@ bool checkSerialPort(const char* portString, bool silent)
...
@@ -103,16 +103,16 @@ bool checkSerialPort(const char* portString, bool silent)
bool
ezspProcessCommandOptions
(
int
argc
,
char
*
argv
[])
bool
ezspProcessCommandOptions
(
int
argc
,
char
*
argv
[])
{
{
char
errStr
[
ERR_LEN
]
=
""
;
char
errStr
[
ERR_LEN
]
=
""
;
if
(
!
ezspInternalProcessCommandOptions
(
argc
,
argv
,
errStr
))
{
if
(
!
ezspInternalProcessCommandOptions
(
argc
,
argv
,
errStr
))
{
return
false
;
return
false
;
}
}
if
(
*
errStr
!=
'\0'
)
{
if
(
*
errStr
!=
'\0'
)
{
fprintf
(
stderr
,
"%s"
,
errStr
);
fprintf
(
stderr
,
"%s"
,
errStr
);
ezspPrintUsage
(
argv
[
0
]);
ezspPrintUsage
(
argv
[
0
]);
}
}
return
(
*
errStr
==
'\0'
);
return
(
*
errStr
==
'\0'
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
platform/zigbee/protocol/zigbee/app/framework/include/af-types.h
View file @
e5cd9e56
...
@@ -1122,26 +1122,26 @@ typedef struct {
...
@@ -1122,26 +1122,26 @@ typedef struct {
* an upgrade file.
* an upgrade file.
*/
*/
typedef
struct
{
typedef
struct
{
uint16_t
manufacturerId
;
uint16_t
manufacturerId
;
uint16_t
imageTypeId
;
uint16_t
imageTypeId
;
uint32_t
firmwareVersion
;
uint32_t
firmwareVersion
;
/**
/**
* This is only used for device specific files.
* This is only used for device specific files.
* It will be set to all 0's when the image does not
* It will be set to all 0's when the image does not
* have an upgrade destination field in it.
* have an upgrade destination field in it.
* Little endian format.
* Little endian format.
*/
*/
uint8_t
deviceSpecificFileEui64
[
EUI64_SIZE
];
uint8_t
deviceSpecificFileEui64
[
EUI64_SIZE
];
}
EmberAfOtaImageId
;
}
EmberAfOtaImageId
;
/**
/**
* @brief The list of options possible for the image block request/response.
* @brief The list of options possible for the image block request/response.
*/
*/
enum
{
enum
{
EMBER_AF_IMAGE_BLOCK_REQUEST_OPTIONS_NONE
=
0
,
EMBER_AF_IMAGE_BLOCK_REQUEST_OPTIONS_NONE
=
0
,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_CLIENT
=
1
,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_CLIENT
=
1
,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_SERVER
=
2
,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_SERVER
=
2
,
};
};
typedef
uint8_t
EmberAfImageBlockRequestOptions
;
typedef
uint8_t
EmberAfImageBlockRequestOptions
;
...
@@ -1150,18 +1150,18 @@ typedef uint8_t EmberAfImageBlockRequestOptions;
...
@@ -1150,18 +1150,18 @@ typedef uint8_t EmberAfImageBlockRequestOptions;
* emberAfImageBlockRequestCallback() to let the application decide what to do.
* emberAfImageBlockRequestCallback() to let the application decide what to do.
*/
*/
typedef
struct
{
typedef
struct
{
const
EmberAfOtaImageId
*
id
;
const
EmberAfOtaImageId
*
id
;
uint32_t
offset
;
uint32_t
offset
;
uint32_t
waitTimeSecondsResponse
;
uint32_t
waitTimeSecondsResponse
;
EmberNodeId
source
;
EmberNodeId
source
;
EmberEUI64
sourceEui
;
// optionally present in messages
EmberEUI64
sourceEui
;
// optionally present in messages
// The minBlockRequestPeriod can be treated as milliseconds or seconds on the
// The minBlockRequestPeriod can be treated as milliseconds or seconds on the
// client. The OTA server plugin has optional support to probe clients and
// client. The OTA server plugin has optional support to probe clients and
// treat this field with appropriate units (ms or sec)
// treat this field with appropriate units (ms or sec)
uint16_t
minBlockRequestPeriod
;
// optionally present in messages
uint16_t
minBlockRequestPeriod
;
// optionally present in messages
uint8_t
maxDataSize
;
uint8_t
maxDataSize
;
uint8_t
clientEndpoint
;
uint8_t
clientEndpoint
;
EmberAfImageBlockRequestOptions
bitmask
;
EmberAfImageBlockRequestOptions
bitmask
;
}
EmberAfImageBlockRequestCallbackStruct
;
}
EmberAfImageBlockRequestCallbackStruct
;
/**
/**
...
@@ -1169,11 +1169,11 @@ typedef struct {
...
@@ -1169,11 +1169,11 @@ typedef struct {
* device operation.
* device operation.
*/
*/
typedef
enum
{
typedef
enum
{
EMBER_AF_OTA_STORAGE_SUCCESS
=
0
,
EMBER_AF_OTA_STORAGE_SUCCESS
=
0
,
EMBER_AF_OTA_STORAGE_ERROR
=
1
,
EMBER_AF_OTA_STORAGE_ERROR
=
1
,
EMBER_AF_OTA_STORAGE_RETURN_DATA_TOO_LONG
=
2
,
EMBER_AF_OTA_STORAGE_RETURN_DATA_TOO_LONG
=
2
,
EMBER_AF_OTA_STORAGE_PARTIAL_FILE_FOUND
=
3
,
EMBER_AF_OTA_STORAGE_PARTIAL_FILE_FOUND
=
3
,
EMBER_AF_OTA_STORAGE_OPERATION_IN_PROGRESS
=
4
,
EMBER_AF_OTA_STORAGE_OPERATION_IN_PROGRESS
=
4
,
}
EmberAfOtaStorageStatus
;
}
EmberAfOtaStorageStatus
;
/**
/**
...
@@ -1203,41 +1203,41 @@ typedef uint8_t EmberAfOtaDownloadResult;
...
@@ -1203,41 +1203,41 @@ typedef uint8_t EmberAfOtaDownloadResult;
* It is not a byte-for-byte copy.
* It is not a byte-for-byte copy.
*/
*/
typedef
struct
{
typedef
struct
{
// Magic Number omitted since it is always the same.
// Magic Number omitted since it is always the same.
uint16_t
headerVersion
;
uint16_t
headerVersion
;
uint16_t
headerLength
;
uint16_t
headerLength
;
uint16_t
fieldControl
;
uint16_t
fieldControl
;
uint16_t
manufacturerId
;
uint16_t
manufacturerId
;
uint16_t
imageTypeId
;
// a.k.a. Device ID
uint16_t
imageTypeId
;
// a.k.a. Device ID
uint32_t
firmwareVersion
;
uint32_t
firmwareVersion
;
uint16_t
zigbeeStackVersion
;
uint16_t
zigbeeStackVersion
;
/**
/**
* @brief The spec. does NOT require that the string be NULL terminated in the
* @brief The spec. does NOT require that the string be NULL terminated in the
* header stored on disk. Therefore we make sure we can support a
* header stored on disk. Therefore we make sure we can support a
* 32-character string without a NULL terminator by adding +1 in the data
* 32-character string without a NULL terminator by adding +1 in the data
* structure.
* structure.
*/
*/
uint8_t
headerString
[
EMBER_AF_OTA_MAX_HEADER_STRING_LENGTH
+
1
];
uint8_t
headerString
[
EMBER_AF_OTA_MAX_HEADER_STRING_LENGTH
+
1
];
/**
/**
* @brief When reading the header this will be the complete length of
* @brief When reading the header this will be the complete length of
* the file. When writing the header, this must be set to
* the file. When writing the header, this must be set to
* the length of the MFG image data portion including all tags.
* the length of the MFG image data portion including all tags.
*/
*/
uint32_t
imageSize
;
uint32_t
imageSize
;
/**
/**
* @brief The remaining four fields are optional. The field control should be checked
* @brief The remaining four fields are optional. The field control should be checked
* to determine if their values are valid.
* to determine if their values are valid.
*/
*/
uint8_t
securityCredentials
;
uint8_t
securityCredentials
;
union
{
union
{
uint8_t
EUI64
[
EUI64_SIZE
];
uint8_t
EUI64
[
EUI64_SIZE
];
uint8_t
UID
[
UID_SIZE
];
uint8_t
UID
[
UID_SIZE
];
}
upgradeFileDestination
;
}
upgradeFileDestination
;
uint16_t
minimumHardwareVersion
;
uint16_t
minimumHardwareVersion
;
uint16_t
maximumHardwareVersion
;
uint16_t
maximumHardwareVersion
;
}
EmberAfOtaHeader
;
}
EmberAfOtaHeader
;
/**
/**
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/backchannel-support.c
View file @
e5cd9e56
...
@@ -89,94 +89,94 @@ static int myVprintf(int fd, const char* formatString, va_list ap);
...
@@ -89,94 +89,94 @@ static int myVprintf(int fd, const char* formatString, va_list ap);
EmberStatus
backchannelStartServer
(
uint8_t
port
)
EmberStatus
backchannelStartServer
(
uint8_t
port
)
{
{
struct
sockaddr_in
serverAddress
;
struct
sockaddr_in
serverAddress
;
int
flags
;
int
flags
;
if
(
!
backchannelEnable
)
{
if
(
!
backchannelEnable
)
{
return
EMBER_INVALID_CALL
;
return
EMBER_INVALID_CALL
;
}
}
if
(
port
>
1
)
{
if
(
port
>
1
)
{
return
EMBER_SERIAL_INVALID_PORT
;
return
EMBER_SERIAL_INVALID_PORT
;
}
}
if
(
socketFd
[
port
]
!=
-
1
)
{
if
(
socketFd
[
port
]
!=
-
1
)
{
return
EMBER_INVALID_CALL
;
return
EMBER_INVALID_CALL
;
}
}
socketFd
[
port
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
socketFd
[
port
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
socketFd
[
port
]
<
0
)
{
if
(
socketFd
[
port
]
<
0
)
{
unixError
(
"Error: Could not open socket"
);
unixError
(
"Error: Could not open socket"
);
return
EMBER_ERR_FATAL
;
return
EMBER_ERR_FATAL
;
}
}
flags
=
1
;
// Enable SO_REUSEADDR to reduce bind() complaints
flags
=
1
;
// Enable SO_REUSEADDR to reduce bind() complaints
(
void
)
setsockopt
(
socketFd
[
port
],
SOL_SOCKET
,
SO_REUSEADDR
,
&
flags
,
(
void
)
setsockopt
(
socketFd
[
port
],
SOL_SOCKET
,
SO_REUSEADDR
,
&
flags
,
sizeof
(
flags
));
sizeof
(
flags
));
bzero
(
&
(
clientConnections
[
port
]),
sizeof
(
struct
sockaddr_in
));
bzero
(
&
(
clientConnections
[
port
]),
sizeof
(
struct
sockaddr_in
));
bzero
((
char
*
)
&
serverAddress
,
sizeof
(
serverAddress
));
bzero
((
char
*
)
&
serverAddress
,
sizeof
(
serverAddress
));
serverAddress
.
sin_family
=
AF_INET
;
serverAddress
.
sin_family
=
AF_INET
;
serverAddress
.
sin_addr
.
s_addr
=
INADDR_ANY
;
serverAddress
.
sin_addr
.
s_addr
=
INADDR_ANY
;
serverAddress
.
sin_port
=
htons
(
SERVER_PORT_OFFSET
+
port
);
serverAddress
.
sin_port
=
htons
(
SERVER_PORT_OFFSET
+
port
);
if
(
bind
(
socketFd
[
port
],
if
(
bind
(
socketFd
[
port
],
(
struct
sockaddr
*
)
&
serverAddress
,
(
struct
sockaddr
*
)
&
serverAddress
,
sizeof
(
serverAddress
))
<
0
)
{
sizeof
(
serverAddress
))
<
0
)
{
unixError
(
"Error: Could not bind socket to %u"
,
SERVER_PORT_OFFSET
+
port
);
unixError
(
"Error: Could not bind socket to %u"
,
SERVER_PORT_OFFSET
+
port
);
return
EMBER_ERR_FATAL
;
return
EMBER_ERR_FATAL
;
}
}
if
(
0
>
listen
(
socketFd
[
port
],
0
))
{
if
(
0
>
listen
(
socketFd
[
port
],
0
))
{
unixError
(
"Error: Could not mark socket as listening"
);
unixError
(
"Error: Could not mark socket as listening"
);
return
EMBER_ERR_FATAL
;
return
EMBER_ERR_FATAL
;
}
}
infoPrint
(
"Listening for connections on port %u"
,
SERVER_PORT_OFFSET
+
port
);
infoPrint
(
"Listening for connections on port %u"
,
SERVER_PORT_OFFSET
+
port
);
return
EMBER_SUCCESS
;
return
EMBER_SUCCESS
;
}
}
EmberStatus
backchannelClientConnectionCleanup
(
uint8_t
port
)
EmberStatus
backchannelClientConnectionCleanup
(
uint8_t
port
)
{
{
if
(
!
backchannelEnable
)
{
if
(
!
backchannelEnable
)
{
return
EMBER_INVALID_CALL
;
return
EMBER_INVALID_CALL
;
}
}
if
(
port
>
1
)
{
if
(
port
>
1
)
{
return
EMBER_SERIAL_INVALID_PORT
;
return
EMBER_SERIAL_INVALID_PORT
;
}
}
if
(
clientFd
[
port
]
!=
INVALID_FD
)
{
if
(
clientFd
[
port
]
!=
INVALID_FD
)
{
myPrintf
(
REMOTE_STDOUT
,
myPrintf
(
REMOTE_STDOUT
,
"Server closing client connection from %s:%u on port %u
\n
"
,
"Server closing client connection from %s:%u on port %u
\n
"
,
inet_ntoa
(
clientConnections
[
port
].
sin_addr
),
inet_ntoa
(
clientConnections
[
port
].
sin_addr
),
ntohs
(
clientConnections
[
port
].
sin_port
),
ntohs
(
clientConnections
[
port
].
sin_port
),
SERVER_PORT_OFFSET
+
port
);
SERVER_PORT_OFFSET
+
port
);
infoPrint
(
"Server closing client connection from %s:%u on port %u
\n
"
,
infoPrint
(
"Server closing client connection from %s:%u on port %u
\n
"
,
inet_ntoa
(
clientConnections
[
port
].
sin_addr
),
inet_ntoa
(
clientConnections
[
port
].
sin_addr
),
ntohs
(
clientConnections
[
port
].
sin_port
),
ntohs
(
clientConnections
[
port
].
sin_port
),
SERVER_PORT_OFFSET
+
port
);
SERVER_PORT_OFFSET
+
port
);
close
(
clientFd
[
port
]);
close
(
clientFd
[
port
]);
clientFd
[
port
]
=
INVALID_FD
;
clientFd
[
port
]
=
INVALID_FD
;
bzero
(
&
(
clientConnections
[
port
]),
sizeof
(
struct
sockaddr_in
));
bzero
(
&
(
clientConnections
[
port
]),
sizeof
(
struct
sockaddr_in
));
}
}
return
EMBER_SUCCESS
;
return
EMBER_SUCCESS
;
}
}
EmberStatus
backchannelStopServer
(
uint8_t
port
)
EmberStatus
backchannelStopServer
(
uint8_t
port
)
{
{
if
(
!
backchannelEnable
)
{
if
(
!
backchannelEnable
)
{
return
EMBER_INVALID_CALL
;
return
EMBER_INVALID_CALL
;
}
}
if
(
port
>
1
)
{
if
(
port
>
1
)
{
return
EMBER_SERIAL_INVALID_PORT
;
return
EMBER_SERIAL_INVALID_PORT
;
}
}
backchannelClientConnectionCleanup
(
port
);
backchannelClientConnectionCleanup
(
port
);
if
(
socketFd
[
port
]
!=
INVALID_FD
)
{
if
(
socketFd
[
port
]
!=
INVALID_FD
)
{
myPrintf
(
LOCAL_STDOUT
,
"Server closing socket connection %u
\n
"
,
myPrintf
(
LOCAL_STDOUT
,
"Server closing socket connection %u
\n
"
,
SERVER_PORT_OFFSET
+
port
);
SERVER_PORT_OFFSET
+
port
);
close
(
socketFd
[
port
]);
close
(
socketFd
[
port
]);
socketFd
[
port
]
=
INVALID_FD
;
socketFd
[
port
]
=
INVALID_FD
;
}
}
return
EMBER_SUCCESS
;
return
EMBER_SUCCESS
;
}
}
// Retrieves a single byte from the client connection. Returns the number
// Retrieves a single byte from the client connection. Returns the number
...
@@ -226,23 +226,23 @@ EmberStatus backchannelSend(uint8_t port, uint8_t * data, uint8_t length)
...
@@ -226,23 +226,23 @@ EmberStatus backchannelSend(uint8_t port, uint8_t * data, uint8_t length)
// If one doesn't exist, it can wait for a new connection and return
// If one doesn't exist, it can wait for a new connection and return
// the result.
// the result.
BackchannelState
backchannelCheckConnection
(
uint8_t
port
,
BackchannelState
backchannelCheckConnection
(
uint8_t
port
,
bool
waitForConnection
)
bool
waitForConnection
)
{
{
if
(
!
backchannelEnable
)
{
if
(
!
backchannelEnable
)
{
return
CONNECTION_ERROR
;
return
CONNECTION_ERROR
;
}
else
if
(
clientFd
[
port
]
>=
0
)
{
}
else
if
(
clientFd
[
port
]
>=
0
)
{
return
CONNECTION_EXISTS
;
return
CONNECTION_EXISTS
;
}
}
bool
getConnection
=
false
;
bool
getConnection
=
false
;
if
(
waitForConnection
)
{
if
(
waitForConnection
)
{
infoPrint
(
"Waiting for client connection on port %u"
,
infoPrint
(
"Waiting for client connection on port %u"
,
port
+
SERVER_PORT_OFFSET
);
port
+
SERVER_PORT_OFFSET
);
getConnection
=
true
;
getConnection
=
true
;
}
else
if
(
!
willServerConnectionBlock
(
port
))
{
}
else
if
(
!
willServerConnectionBlock
(
port
))
{
getConnection
=
true
;
getConnection
=
true
;
}
}
if
(
getConnection
)
{
if
(
getConnection
)
{
return
(
getNewConnection
(
port
)
return
(
getNewConnection
(
port
)
...
@@ -450,32 +450,32 @@ static bool getNewConnection(uint8_t port)
...
@@ -450,32 +450,32 @@ static bool getNewConnection(uint8_t port)
// Print an error message plus the associated 'errno' string
// Print an error message plus the associated 'errno' string
static
void
unixError
(
const
char
*
format
,
...)
static
void
unixError
(
const
char
*
format
,
...)
{
{
va_list
ap
=
{
0
};
va_list
ap
=
{
0
};
va_start
(
ap
,
format
);
va_start
(
ap
,
format
);
myVprintf
(
LOCAL_STDERR
,
format
,
ap
);
myVprintf
(
LOCAL_STDERR
,
format
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
myPrintf
(
LOCAL_STDERR
,
": %s
\n
"
,
strerror
(
errno
));
myPrintf
(
LOCAL_STDERR
,
": %s
\n
"
,
strerror
(
errno
));
}
}
static
void
debugPrint
(
const
char
*
formatString
,
...)
static
void
debugPrint
(
const
char
*
formatString
,
...)
{
{
if
(
debugOn
)
{
if
(
debugOn
)
{
va_list
ap
=
{
0
};
va_list
ap
=
{
0
};
myPrintf
(
LOCAL_STDERR
,
"[%s] "
,
debugString
);
myPrintf
(
LOCAL_STDERR
,
"[%s] "
,
debugString
);
va_start
(
ap
,
formatString
);
va_start
(
ap
,
formatString
);
myVprintf
(
LOCAL_STDERR
,
formatString
,
ap
);
myVprintf
(
LOCAL_STDERR
,
formatString
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
myPrintf
(
LOCAL_STDERR
,
"
\n
"
);
myPrintf
(
LOCAL_STDERR
,
"
\n
"
);
}
}
}
}
static
void
infoPrint
(
const
char
*
formatString
,
...)
static
void
infoPrint
(
const
char
*
formatString
,
...)
{
{
va_list
ap
=
{
0
};
va_list
ap
=
{
0
};
va_start
(
ap
,
formatString
);
va_start
(
ap
,
formatString
);
myVprintf
(
LOCAL_STDOUT
,
formatString
,
ap
);
myVprintf
(
LOCAL_STDOUT
,
formatString
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
myPrintf
(
LOCAL_STDOUT
,
"
\n
"
);
myPrintf
(
LOCAL_STDOUT
,
"
\n
"
);
}
}
// Because we mess around with FDs, we need our own printing routine
// Because we mess around with FDs, we need our own printing routine
...
@@ -483,20 +483,20 @@ static void infoPrint(const char* formatString, ...)
...
@@ -483,20 +483,20 @@ static void infoPrint(const char* formatString, ...)
static
int
myPrintf
(
int
fd
,
const
char
*
formatString
,
...)
static
int
myPrintf
(
int
fd
,
const
char
*
formatString
,
...)
{
{
va_list
ap
=
{
0
};
va_list
ap
=
{
0
};
int
returnCode
;
int
returnCode
;
va_start
(
ap
,
formatString
);
va_start
(
ap
,
formatString
);
returnCode
=
myVprintf
(
fd
,
formatString
,
ap
);
returnCode
=
myVprintf
(
fd
,
formatString
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
return
returnCode
;
return
returnCode
;
}
}
// Returns 0 on success, 1 on error
// Returns 0 on success, 1 on error
static
int
myVprintf
(
int
fd
,
const
char
*
formatString
,
va_list
ap
)
static
int
myVprintf
(
int
fd
,
const
char
*
formatString
,
va_list
ap
)
{
{
int
length
;
int
length
;
char
string
[
MAX_STRING_LENGTH
];
char
string
[
MAX_STRING_LENGTH
];
length
=
vsnprintf
(
string
,
MAX_STRING_LENGTH
-
1
,
formatString
,
ap
);
length
=
vsnprintf
(
string
,
MAX_STRING_LENGTH
-
1
,
formatString
,
ap
);
string
[
length
]
=
'\0'
;
string
[
length
]
=
'\0'
;
return
(
length
!=
write
(
fd
,
string
,
length
));
return
(
length
!=
write
(
fd
,
string
,
length
));
}
}
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/gateway-support.c
View file @
e5cd9e56
...
@@ -65,28 +65,28 @@ static void ezspSerialPortCallback(EzspSerialPortEvent event, int fileDescriptor
...
@@ -65,28 +65,28 @@ static void ezspSerialPortCallback(EzspSerialPortEvent event, int fileDescriptor
static
EmberStatus
gatewayBackchannelStart
(
void
)
static
EmberStatus
gatewayBackchannelStart
(
void
)
{
{
if
(
backchannelEnable
)
{
if
(
backchannelEnable
)
{
if
(
EMBER_SUCCESS
!=
backchannelStartServer
(
SERIAL_PORT_CLI
))
{
if
(
EMBER_SUCCESS
!=
backchannelStartServer
(
SERIAL_PORT_CLI
))
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"Fatal: Failed to start backchannel services for CLI.
\n
"
);
"Fatal: Failed to start backchannel services for CLI.
\n
"
);
return
EMBER_ERR_FATAL
;
return
EMBER_ERR_FATAL
;
}
}
if
(
EMBER_SUCCESS
!=
backchannelStartServer
(
SERIAL_PORT_RAW
))
{
if
(
EMBER_SUCCESS
!=
backchannelStartServer
(
SERIAL_PORT_RAW
))
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"Fatal: Failed to start backchannel services for RAW data.
\n
"
);
"Fatal: Failed to start backchannel services for RAW data.
\n
"
);
return
EMBER_ERR_FATAL
;
return
EMBER_ERR_FATAL
;
}
}
}
}
return
EMBER_SUCCESS
;
return
EMBER_SUCCESS
;
}
}
void
gatewayBackchannelStop
(
void
)
void
gatewayBackchannelStop
(
void
)
{
{
if
(
backchannelEnable
)
{
if
(
backchannelEnable
)
{
backchannelStopServer
(
SERIAL_PORT_CLI
);
backchannelStopServer
(
SERIAL_PORT_CLI
);
backchannelStopServer
(
SERIAL_PORT_RAW
);
backchannelStopServer
(
SERIAL_PORT_RAW
);
}
}
}
}
bool
emberAfMainStartCallback
(
int
*
returnCode
,
bool
emberAfMainStartCallback
(
int
*
returnCode
,
...
@@ -95,21 +95,21 @@ bool emberAfMainStartCallback(int* returnCode,
...
@@ -95,21 +95,21 @@ bool emberAfMainStartCallback(int* returnCode,
{
{
debugPrint
(
"gatewaitInit()"
);
debugPrint
(
"gatewaitInit()"
);
// This will process EZSP command-line options as well as determine
// This will process EZSP command-line options as well as determine
// whether the backchannel should be turned on.
// whether the backchannel should be turned on.
if
(
!
ezspProcessCommandOptions
(
argc
,
argv
))
{
if
(
!
ezspProcessCommandOptions
(
argc
,
argv
))
{
*
returnCode
=
EMBER_ERR_FATAL
;
*
returnCode
=
EMBER_ERR_FATAL
;
return
true
;
return
true
;
}
}
*
returnCode
=
gatewayBackchannelStart
();
*
returnCode
=
gatewayBackchannelStart
();
if
(
*
returnCode
!=
EMBER_SUCCESS
)
{
if
(
*
returnCode
!=
EMBER_SUCCESS
)
{
return
true
;
return
true
;
}
}
emberSerialSetPrompt
(
cliPrompt
);
emberSerialSetPrompt
(
cliPrompt
);
emberSerialCommandCompletionInit
(
emberCommandTable
);
emberSerialCommandCompletionInit
(
emberCommandTable
);
return
false
;
return
false
;
}
}
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin-host/gateway/gateway-support.h
View file @
e5cd9e56
...
@@ -3,10 +3,10 @@ void gatewayBackchannelStop(void);
...
@@ -3,10 +3,10 @@ void gatewayBackchannelStop(void);
typedef
uint8_t
BackchannelState
;
typedef
uint8_t
BackchannelState
;
enum
{
enum
{
NO_CONNECTION
=
0
,
NO_CONNECTION
=
0
,
CONNECTION_EXISTS
=
1
,
CONNECTION_EXISTS
=
1
,
NEW_CONNECTION
=
2
,
NEW_CONNECTION
=
2
,
CONNECTION_ERROR
=
3
,
CONNECTION_ERROR
=
3
,
};
};
extern
const
bool
backchannelSupported
;
extern
const
bool
backchannelSupported
;
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-common/ota-cli.h
View file @
e5cd9e56
...
@@ -38,7 +38,7 @@ void emAfOtaImageDelete(void);
...
@@ -38,7 +38,7 @@ void emAfOtaImageDelete(void);
// Server CLI interface
// Server CLI interface
#if !defined (EMBER_AF_PLUGIN_OTA_SERVER)
#if !defined (EMBER_AF_PLUGIN_OTA_SERVER)
#define OTA_SERVER_COMMANDS
#define OTA_SERVER_COMMANDS
#endif
#endif
void
otaImageNotifyCommand
(
void
);
void
otaImageNotifyCommand
(
void
);
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-common/ota-common.c
View file @
e5cd9e56
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
// This relates all OTA command IDs in app/framework/gen/command-id.h
// This relates all OTA command IDs in app/framework/gen/command-id.h
// to minimum message lengths (does not include EMBER_AF_ZCL_OVERHEAD)
// to minimum message lengths (does not include EMBER_AF_ZCL_OVERHEAD)
PGM
uint8_t
emAfOtaMinMessageLengths
[]
=
{
PGM
uint8_t
emAfOtaMinMessageLengths
[]
=
{
2
,
// Image Notify
2
,
// Image Notify
8
,
// Query Next Image Request
8
,
// Query Next Image Request
1
,
// Query Next Image Response
1
,
// Query Next Image Response
13
,
// Image Block Request
13
,
// Image Block Request
13
,
// Image Page Request
13
,
// Image Page Request
1
,
// Image Block Response (abort is shortest)
1
,
// Image Block Response (abort is shortest)
...
@@ -48,14 +48,14 @@ EmberAfOtaImageId emAfOtaCreateEmberAfOtaImageIdStruct(uint16_t manufacturerId,
...
@@ -48,14 +48,14 @@ EmberAfOtaImageId emAfOtaCreateEmberAfOtaImageIdStruct(uint16_t manufacturerId,
// This assumes the message has already been validated for its length
// This assumes the message has already been validated for its length
uint8_t
emAfOtaParseImageIdFromMessage
(
EmberAfOtaImageId
*
returnId
,
uint8_t
emAfOtaParseImageIdFromMessage
(
EmberAfOtaImageId
*
returnId
,
const
uint8_t
*
buffer
,
const
uint8_t
*
buffer
,
uint8_t
length
)
uint8_t
length
)
{
{
returnId
->
manufacturerId
=
emberAfGetInt16u
(
buffer
,
0
,
length
);
returnId
->
manufacturerId
=
emberAfGetInt16u
(
buffer
,
0
,
length
);
returnId
->
imageTypeId
=
emberAfGetInt16u
(
buffer
,
2
,
length
);
returnId
->
imageTypeId
=
emberAfGetInt16u
(
buffer
,
2
,
length
);
returnId
->
firmwareVersion
=
emberAfGetInt32u
(
buffer
,
4
,
length
);
returnId
->
firmwareVersion
=
emberAfGetInt32u
(
buffer
,
4
,
length
);
MEMSET
(
returnId
->
deviceSpecificFileEui64
,
0
,
EUI64_SIZE
);
MEMSET
(
returnId
->
deviceSpecificFileEui64
,
0
,
EUI64_SIZE
);
return
8
;
return
8
;
}
}
#if defined(EMBER_AF_PRINT_CORE)
#if defined(EMBER_AF_PRINT_CORE)
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server-policy/ota-server-policy.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-cli.c
View file @
e5cd9e56
...
@@ -149,9 +149,9 @@ static PGM_P notifyArguments[] = {
...
@@ -149,9 +149,9 @@ static PGM_P notifyArguments[] = {
emberCommandEntryTerminator(),
emberCommandEntryTerminator(),
EmberCommandEntry
emberAfPluginOtaServerCommands
[]
=
{
EmberCommandEntry
emberAfPluginOtaServerCommands
[]
=
{
OTA_SERVER_COMMANDS
OTA_SERVER_COMMANDS
emberCommandEntryTerminator
(),
emberCommandEntryTerminator
(),
};
};
#endif // EMBER_AF_GENERATE_CLI
#endif // EMBER_AF_GENERATE_CLI
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-dynamic-block-period.c
View file @
e5cd9e56
...
@@ -79,13 +79,13 @@ uint8_t getIndexForDownloadingNodeId(EmberNodeId nodeId)
...
@@ -79,13 +79,13 @@ uint8_t getIndexForDownloadingNodeId(EmberNodeId nodeId)
void
emAfOtaServerDynamicBlockPeriodInit
()
void
emAfOtaServerDynamicBlockPeriodInit
()
{
{
// Initialize array to have no current OTA downloads
// Initialize array to have no current OTA downloads
uint8_t
nodeIndex
;
uint8_t
nodeIndex
;
for
(
nodeIndex
=
0
;
nodeIndex
<
MAX_DOWNLOADS
;
nodeIndex
++
)
{
for
(
nodeIndex
=
0
;
nodeIndex
<
MAX_DOWNLOADS
;
nodeIndex
++
)
{
downloadingNodes
[
nodeIndex
].
nodeId
=
EMBER_NULL_NODE_ID
;
downloadingNodes
[
nodeIndex
].
nodeId
=
EMBER_NULL_NODE_ID
;
downloadingNodes
[
nodeIndex
].
unitDiscoveryState
=
STATE_NONE
;
downloadingNodes
[
nodeIndex
].
unitDiscoveryState
=
STATE_NONE
;
downloadingNodes
[
nodeIndex
].
msTickWhenLastSeen
=
0
;
downloadingNodes
[
nodeIndex
].
msTickWhenLastSeen
=
0
;
}
}
}
}
void
emAfOtaServerDynamicBlockPeriodTick
()
void
emAfOtaServerDynamicBlockPeriodTick
()
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server-page-request.c
View file @
e5cd9e56
...
@@ -111,11 +111,11 @@ uint8_t emAfOtaPageRequestHandler(uint8_t clientEndpoint,
...
@@ -111,11 +111,11 @@ uint8_t emAfOtaPageRequestHandler(uint8_t clientEndpoint,
void
emAfOtaPageRequestTick
(
uint8_t
endpoint
)
void
emAfOtaPageRequestTick
(
uint8_t
endpoint
)
{
{
if
(
requesterNodeId
==
EMBER_NULL_NODE_ID
)
{
if
(
requesterNodeId
==
EMBER_NULL_NODE_ID
)
{
return
;
return
;
}
}
sendBlockRequest
();
sendBlockRequest
();
emberAfScheduleServerTickExtended
(
endpoint
,
emberAfScheduleServerTickExtended
(
endpoint
,
ZCL_OTA_BOOTLOAD_CLUSTER_ID
,
ZCL_OTA_BOOTLOAD_CLUSTER_ID
,
requesterResponseSpacing
,
requesterResponseSpacing
,
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage-common-cli.c
View file @
e5cd9e56
...
@@ -142,10 +142,10 @@ void emAfOtaImageDelete(void)
...
@@ -142,10 +142,10 @@ void emAfOtaImageDelete(void)
void
emAfOtaReloadStorageDevice
(
void
)
void
emAfOtaReloadStorageDevice
(
void
)
{
{
#if defined (EMBER_AF_PLUGIN_OTA_STORAGE_POSIX_FILESYSTEM)
#if defined (EMBER_AF_PLUGIN_OTA_STORAGE_POSIX_FILESYSTEM)
emAfOtaStorageClose
();
emAfOtaStorageClose
();
#endif
#endif
emberAfOtaStorageInitCallback
();
emberAfOtaStorageInitCallback
();
}
}
#define PRINT_BLOCK_LENGTH 64
#define PRINT_BLOCK_LENGTH 64
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage-common.c
View file @
e5cd9e56
...
@@ -39,18 +39,18 @@
...
@@ -39,18 +39,18 @@
EmberAfOtaImageId
emAfOtaStorageGetImageIdFromHeader
(
const
EmberAfOtaHeader
*
header
)
EmberAfOtaImageId
emAfOtaStorageGetImageIdFromHeader
(
const
EmberAfOtaHeader
*
header
)
{
{
EmberAfOtaImageId
id
=
INVALID_OTA_IMAGE_ID
;
EmberAfOtaImageId
id
=
INVALID_OTA_IMAGE_ID
;
id
.
manufacturerId
=
header
->
manufacturerId
;
id
.
manufacturerId
=
header
->
manufacturerId
;
id
.
imageTypeId
=
header
->
imageTypeId
;
id
.
imageTypeId
=
header
->
imageTypeId
;
id
.
firmwareVersion
=
header
->
firmwareVersion
;
id
.
firmwareVersion
=
header
->
firmwareVersion
;
if
(
headerHasUpgradeFileDest
(
header
))
{
if
(
headerHasUpgradeFileDest
(
header
))
{
MEMCOPY
(
id
.
deviceSpecificFileEui64
,
MEMCOPY
(
id
.
deviceSpecificFileEui64
,
&
header
->
upgradeFileDestination
,
&
header
->
upgradeFileDestination
,
EUI64_SIZE
);
EUI64_SIZE
);
}
}
return
id
;
return
id
;
}
}
uint16_t
emGetUpgradeFileDestinationLength
(
uint16_t
headerVersion
)
uint16_t
emGetUpgradeFileDestinationLength
(
uint16_t
headerVersion
)
...
@@ -249,7 +249,7 @@ EmberAfOtaStorageStatus emAfOtaStorageReadAllTagInfo(const EmberAfOtaImageId* id
...
@@ -249,7 +249,7 @@ EmberAfOtaStorageStatus emAfOtaStorageReadAllTagInfo(const EmberAfOtaImageId* id
bool
emberAfIsOtaImageIdValid
(
const
EmberAfOtaImageId
*
idToCompare
)
bool
emberAfIsOtaImageIdValid
(
const
EmberAfOtaImageId
*
idToCompare
)
{
{
return
(
0
!=
MEMPGMCOMPARE
(
idToCompare
,
return
(
0
!=
MEMPGMCOMPARE
(
idToCompare
,
&
emberAfInvalidImageId
,
&
emberAfInvalidImageId
,
sizeof
(
EmberAfOtaImageId
)));
sizeof
(
EmberAfOtaImageId
)));
}
}
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-common/ota-storage.h
View file @
e5cd9e56
...
@@ -40,18 +40,18 @@
...
@@ -40,18 +40,18 @@
#define TAG_OVERHEAD (2 + 4) // 2 bytes for the tag ID, 4 bytes for the length
#define TAG_OVERHEAD (2 + 4) // 2 bytes for the tag ID, 4 bytes for the length
#define isValidHeaderVersion(headerVersion) \
#define isValidHeaderVersion(headerVersion) \
((headerVersion == OTA_HEADER_VERSION_ZIGBEE) || (headerVersion == OTA_HEADER_VERSION_THREAD))
((headerVersion == OTA_HEADER_VERSION_ZIGBEE) || (headerVersion == OTA_HEADER_VERSION_THREAD))
#define SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK 0x0001
#define SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK 0x0001
#define DEVICE_SPECIFIC_FILE_PRESENT_MASK 0x0002
#define DEVICE_SPECIFIC_FILE_PRESENT_MASK 0x0002
#define HARDWARE_VERSIONS_PRESENT_MASK 0x0004
#define HARDWARE_VERSIONS_PRESENT_MASK 0x0004
#define headerHasSecurityCredentials(header) \
#define headerHasSecurityCredentials(header) \
((header)->fieldControl & SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK)
((header)->fieldControl & SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK)
#define headerHasUpgradeFileDest(header) \
#define headerHasUpgradeFileDest(header) \
((header)->fieldControl & DEVICE_SPECIFIC_FILE_PRESENT_MASK)
((header)->fieldControl & DEVICE_SPECIFIC_FILE_PRESENT_MASK)
#define headerHasHardwareVersions(header) \
#define headerHasHardwareVersions(header) \
((header)->fieldControl & HARDWARE_VERSIONS_PRESENT_MASK)
((header)->fieldControl & HARDWARE_VERSIONS_PRESENT_MASK)
// This size does NOT include the tag overhead.
// This size does NOT include the tag overhead.
#define SIGNATURE_TAG_DATA_SIZE (EUI64_SIZE + EMBER_SIGNATURE_SIZE)
#define SIGNATURE_TAG_DATA_SIZE (EUI64_SIZE + EMBER_SIGNATURE_SIZE)
...
@@ -63,11 +63,11 @@
...
@@ -63,11 +63,11 @@
#define INVALID_EUI64 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define INVALID_EUI64 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define INVALID_OTA_IMAGE_ID \
#define INVALID_OTA_IMAGE_ID \
{ INVALID_MANUFACTURER_ID, \
{ INVALID_MANUFACTURER_ID, \
INVALID_DEVICE_ID, \
INVALID_DEVICE_ID, \
INVALID_FIRMWARE_VERSION, \
INVALID_FIRMWARE_VERSION, \
INVALID_EUI64, \
INVALID_EUI64, \
}
}
#define INVALID_SLOT (uint32_t)-1
#define INVALID_SLOT (uint32_t)-1
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-posix-filesystem/ota-storage-linux.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-storage-posix-filesystem/ota-storage-linux.h
View file @
e5cd9e56
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
typedef
void
(
EmAfOtaStorageFileAddedHandler
)(
const
EmberAfOtaHeader
*
);
typedef
void
(
EmAfOtaStorageFileAddedHandler
)(
const
EmberAfOtaHeader
*
);
typedef
struct
{
typedef
struct
{
bool
memoryDebug
;
bool
memoryDebug
;
bool
fileDebug
;
bool
fileDebug
;
bool
fieldDebug
;
bool
fieldDebug
;
bool
ignoreFilesWithUnderscorePrefix
;
bool
ignoreFilesWithUnderscorePrefix
;
bool
printFileDiscoveryOrRemoval
;
bool
printFileDiscoveryOrRemoval
;
EmAfOtaStorageFileAddedHandler
*
fileAddedHandler
;
EmAfOtaStorageFileAddedHandler
*
fileAddedHandler
;
}
EmAfOtaStorageLinuxConfig
;
}
EmAfOtaStorageLinuxConfig
;
void
emAfOtaStorageGetConfig
(
EmAfOtaStorageLinuxConfig
*
currentConfig
);
void
emAfOtaStorageGetConfig
(
EmAfOtaStorageLinuxConfig
*
currentConfig
);
...
...
platform/zigbee/protocol/zigbee/app/framework/security/af-security-common.c
View file @
e5cd9e56
...
@@ -77,6 +77,6 @@ bool emberAfIsCurrentSecurityProfileSmartEnergy(void)
...
@@ -77,6 +77,6 @@ bool emberAfIsCurrentSecurityProfileSmartEnergy(void)
||
(
emAfCurrentZigbeeProNetwork
->
securityProfile
||
(
emAfCurrentZigbeeProNetwork
->
securityProfile
==
EMBER_AF_SECURITY_PROFILE_SE_FULL
)));
==
EMBER_AF_SECURITY_PROFILE_SE_FULL
)));
#else
#else
return
false
;
return
false
;
#endif
#endif
}
}
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
View file @
e5cd9e56
...
@@ -545,16 +545,12 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
...
@@ -545,16 +545,12 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
halInit
();
halInit
();
INTERRUPTS_ON
();
// Safe to enable interrupts at this point
INTERRUPTS_ON
();
// Safe to enable interrupts at this point
{
int
returnCode
;
int
returnCode
;
if
(
emberAfMainStartCallback
(
&
returnCode
,
if
(
emberAfMainStartCallback
(
&
returnCode
,
APP_FRAMEWORK_MAIN_ARGUMENTS
))
{
//get serial port info
APP_FRAMEWORK_MAIN_ARGUMENTS
))
{
//get serial port info
return
returnCode
;
return
returnCode
;
}
}
}
kk_print
(
"*******************123****************
\r\n
"
);
kk_print_info
(
"
\r\n
-----hello world![%s:%s]-----
\r\n
"
,
__DATE__
,
__TIME__
);
kk_print_version
();
emberSerialInit
(
APP_SERIAL
,
BAUD_RATE
,
PARITY_NONE
,
1
);
//fock child process
emberSerialInit
(
APP_SERIAL
,
BAUD_RATE
,
PARITY_NONE
,
1
);
//fock child process
...
...
platform/zigbee/protocol/zigbee/app/framework/util/client-api.c
View file @
e5cd9e56
...
@@ -379,6 +379,6 @@ EmberApsFrame *emberAfGetCommandApsFrame(void)
...
@@ -379,6 +379,6 @@ EmberApsFrame *emberAfGetCommandApsFrame(void)
void
emberAfSetCommandEndpoints
(
uint8_t
sourceEndpoint
,
uint8_t
destinationEndpoint
)
void
emberAfSetCommandEndpoints
(
uint8_t
sourceEndpoint
,
uint8_t
destinationEndpoint
)
{
{
emAfCommandApsFrame
->
sourceEndpoint
=
sourceEndpoint
;
emAfCommandApsFrame
->
sourceEndpoint
=
sourceEndpoint
;
emAfCommandApsFrame
->
destinationEndpoint
=
destinationEndpoint
;
emAfCommandApsFrame
->
destinationEndpoint
=
destinationEndpoint
;
}
}
platform/zigbee/protocol/zigbee/app/framework/util/process-cluster-message.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
platform/zigbee/protocol/zigbee/app/framework/util/util.c
View file @
e5cd9e56
...
@@ -688,7 +688,7 @@ EmberStatus emberAfSendResponseWithCallback(EmberAfMessageSentFunction callback)
...
@@ -688,7 +688,7 @@ EmberStatus emberAfSendResponseWithCallback(EmberAfMessageSentFunction callback)
EmberStatus
emberAfSendResponse
(
void
)
EmberStatus
emberAfSendResponse
(
void
)
{
{
return
emberAfSendResponseWithCallback
(
NULL
);
return
emberAfSendResponseWithCallback
(
NULL
);
}
}
EmberStatus
emberAfSendImmediateDefaultResponseWithCallback
(
EmberAfStatus
status
,
EmberStatus
emberAfSendImmediateDefaultResponseWithCallback
(
EmberAfStatus
status
,
...
...
platform/zigbee/protocol/zigbee/app/util/serial/linux-serial.c
View file @
e5cd9e56
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment