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
aa37f5da
Commit
aa37f5da
authored
Sep 01, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】设备属性数据表添加设备类型字段
【提交人】陈伟灿
parent
2a977c46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
midware/midware/dm/kk_dm_mng.c
midware/midware/dm/kk_dm_mng.c
+3
-3
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+8
-6
No files found.
midware/midware/dm/kk_dm_mng.c
View file @
aa37f5da
...
...
@@ -148,7 +148,7 @@ static int _dm_init_tsl_params(int devId)
}
return
res
;
}
int
dm_mgr_properities_db_create
(
kk_tsl_t
*
dev_shadow
,
char
*
deviceCode
)
int
dm_mgr_properities_db_create
(
kk_tsl_t
*
dev_shadow
,
char
*
deviceCode
,
int
devType
)
{
int
num
=
0
,
idx
=
0
;
kk_tsl_data_t
*
pProperty
=
NULL
;
...
...
@@ -163,7 +163,7 @@ int dm_mgr_properities_db_create(kk_tsl_t* dev_shadow,char *deviceCode )
pProperty
=
dev_shadow
->
properties
+
idx
;
INFO_PRINT
(
"dm_mgr_properities_db_create pProperty->identifier:%s!!
\n
"
,
pProperty
->
identifier
);
if
(
pProperty
){
kk_property_db_insert
(
deviceCode
,
pProperty
->
identifier
,
pProperty
->
data_value
.
type
);
kk_property_db_insert
(
deviceCode
,
pProperty
->
identifier
,
pProperty
->
data_value
.
type
,
devType
);
}
}
}
...
...
@@ -224,7 +224,7 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
return
FAIL_RETURN
;
}
}
dm_mgr_properities_db_create
(
node
->
dev_shadow
,
deviceCode
);
dm_mgr_properities_db_create
(
node
->
dev_shadow
,
deviceCode
,
dev_type
);
INIT_LIST_HEAD
(
&
node
->
linked_list
);
list_add_tail
(
&
node
->
linked_list
,
&
ctx
->
dev_list
);
...
...
midware/midware/dm/kk_property_db.c
View file @
aa37f5da
...
...
@@ -17,7 +17,8 @@ typedef enum{
DB_DEVICECODE
,
DB_IDENTIFITER
,
DB_VALUE
,
DB_VALUETYPE
,
DB_VALUETYPE
,
DB_DEVTYPE
};
static
kk_property_db_ctx_t
s_kk_property_db_ctx
=
{
0
};
...
...
@@ -60,7 +61,8 @@ static int kk_property_db_Init(void)
deviceCode varchar(33), \
identifier varchar(33), \
value varchar(33), \
valueType INTEGER)"
;
valueType INTEGER, \
devType INTEGER)"
;
char
*
pcErr
;
// DBG_vPrintf(DBG_SQL, "Execute SQL: '%s'\n", pConditionTableDef);
...
...
@@ -129,10 +131,10 @@ static int _kk_check_property_exist(const char* deviceCode,const char* identifie
}
int
kk_property_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
)
int
kk_property_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
devtype
)
{
const
char
*
insertCmd
=
"insert into PropertiesInfo (deviceCode,identifier,value,valueType) \
values ('%s','%s','%s','%d');"
;
const
char
*
insertCmd
=
"insert into PropertiesInfo (deviceCode,identifier,value,valueType
,devType
) \
values ('%s','%s','%s','%d'
,'%d'
);"
;
char
*
sqlCmd
=
NULL
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
...
...
@@ -145,7 +147,7 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
return
SUCCESS_RETURN
;
}
_kk_property_db_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
""
,
valuetype
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
""
,
valuetype
,
devtype
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
...
...
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