Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TIMIQLib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Libraries
TIMIQLib
Commits
a4de2927
Commit
a4de2927
authored
7 years ago
by
Sonia Minolli
Browse files
Options
Downloads
Patches
Plain Diff
Updates for threaded tasks (TANGODEVIC-1647)
parent
d2a76dbd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/timiq/TIMIQLib.h
+3
-0
3 additions, 0 deletions
include/timiq/TIMIQLib.h
src/TIMIQLib.cpp
+80
-13
80 additions, 13 deletions
src/TIMIQLib.cpp
src/TIMIQTypesAndConsts.h
+3
-1
3 additions, 1 deletion
src/TIMIQTypesAndConsts.h
with
86 additions
and
14 deletions
include/timiq/TIMIQLib.h
+
3
−
0
View file @
a4de2927
...
...
@@ -175,10 +175,13 @@ namespace TIMIQLib_ns {
ThreadedAction
*
m_timiq_task
;
void
ExecuteAction
(
timIQConfig
&
cfg
);
void
end_task
()
throw
(
Exception
);
// soso à supprimer:
void
iVal_end_task
()
throw
(
Exception
);
void
qVal_end_task
()
throw
(
Exception
);
void
data_end_task
()
throw
(
Exception
);
void
boardT_end_task
()
throw
(
Exception
);
};
...
...
This diff is collapsed.
Click to expand it.
src/TIMIQLib.cpp
+
80
−
13
View file @
a4de2927
...
...
@@ -25,6 +25,7 @@ if (!m_timiq_hw) \
static_cast
<
const
char
*>
(
"CHECK_TIMIQ_HW()"
));
\
}
// ============================================================================
// ============================================================================
// TIMIQLib::TIMIQLib
// ============================================================================
...
...
@@ -36,6 +37,7 @@ TIMIQLib::TIMIQLib ()
m_internal_timiq_state
=
Undefined
;
m_timiq_task
=
NULL
;
}
// ============================================================================
// TIMIQLib::~TIMIQLib()
// ============================================================================
...
...
@@ -51,10 +53,11 @@ TIMIQLib::~TIMIQLib()
if
(
m_timiq_task
)
{
m_timiq_task
->
exit
();
delete
m_timiq_task
;
//
delete m_timiq_task;
// soso debug - sure needs delete ?
m_timiq_task
=
NULL
;
}
}
// ============================================================================
// TIMIQLib::init
// ============================================================================
...
...
@@ -78,6 +81,7 @@ void TIMIQLib::init(const std::string& ip_address, const short& num_port)
CHECK_TIMIQ_HW
;
}
// ============================================================================
// TIMIQLib::set_data
// ============================================================================
...
...
@@ -209,6 +213,35 @@ void TIMIQLib::iVal_end_task()
m_internal_timiq_state
=
OK
;
}
// soso add
// ============================================================================
// TIMIQLib::end_task
// ============================================================================
void
TIMIQLib
::
end_task
()
throw
(
Exception
)
{
//- Delete task
if
(
this
->
m_timiq_task
)
{
if
(
m_timiq_task
->
m_ti_cfg
.
ti_err
!=
timiq_NO_ERROR
)
{
m_timiq_task
->
exit
();
m_timiq_task
=
NULL
;
std
::
string
msg_err
=
"Threaded task error -msg: "
+
m_timiq_hw
->
get_err_msg
();
throw
Exception
(
static_cast
<
const
char
*>
(
"SOFTWARE_FAILURE"
),
static_cast
<
const
char
*>
(
msg_err
.
c_str
()),
static_cast
<
const
char
*>
(
"TIMIQLib::end_task"
));
}
//- destroy otherwise
m_timiq_task
->
exit
();
m_timiq_task
=
NULL
;
}
//- update state of TIMIQ equipment
//m_internal_timiq_state = OK; -- est mis à jour par get state
}
// ============================================================================
// TIMIQLib::set_qValue
// ============================================================================
...
...
@@ -349,17 +382,45 @@ void TIMIQLib::set_command(E_timiq_cmd_t& cmd)
CHECK_TIMIQ_HW
;
//- write command on TIMIQ equipment
err
=
m_timiq_hw
->
write_command
(
cmd
);
if
(
err
!=
timiq_NO_ERROR
)
// soso add
// thread PLL calibration command:
if
(
cmd
==
RECALIBRATE_PLL
)
{
if
(
m_internal_timiq_state
!=
Busy
)
{
timIQConfig
l_ti_cfg
;
l_ti_cfg
.
id
=
TI_CALIB
;
//- force timiq state = Busy
m_internal_timiq_state
=
Busy
;
m_timiq_task
=
new
ThreadedAction
(
static_cast
<
yat
::
Thread
::
IOArg
>
(
this
),
l_ti_cfg
);
if
(
m_timiq_task
==
NULL
)
{
std
::
string
msg_err
=
"Set Q value error -msg: "
+
m_timiq_hw
->
get_err_msg
();
throw
Exception
(
static_cast
<
const
char
*>
(
"SOFTWARE_FAILURE"
),
static_cast
<
const
char
*>
(
msg_err
.
c_str
()),
static_cast
<
const
char
*>
(
"TIMIQLib::set_command"
));
}
//- start the task to do the pll calibration
m_timiq_task
->
start_undetached
();
}
}
else
{
err
=
m_timiq_hw
->
write_command
(
cmd
);
if
(
err
!=
timiq_NO_ERROR
)
{
std
::
string
msg_err
=
"Set command error -msg: "
+
m_timiq_hw
->
get_err_msg
();
throw
Exception
(
static_cast
<
const
char
*>
(
"SOFTWARE_FAILURE"
),
static_cast
<
const
char
*>
(
msg_err
.
c_str
()),
static_cast
<
const
char
*>
(
"TIMIQLib::set_command()"
));
}
}
//- update state of TIMIQ equipment
m_internal_timiq_state
=
OK
;
//- update state of TIMIQ equipment
m_internal_timiq_state
=
OK
;
}
}
// ============================================================================
...
...
@@ -500,7 +561,7 @@ E_timiq_code_t TIMIQLib::get_state(std::string& status)
CHECK_TIMIQ_HW
;
//- get internal timiq state
if
(
m_internal_timiq_state
!=
Busy
)
//
if (m_internal_timiq_state != Busy)
-- soso debug : update qqsoit l'état
{
//- read status of TIMIQ equipment
err
=
m_timiq_hw
->
read_state_and_status
(
status
,
m_internal_timiq_state
);
...
...
@@ -571,7 +632,6 @@ void ThreadedAction::exit (void)
this
->
m_goOn
=
false
;
}
// ============================================================================
// TIMIQLib::ExecuteAction
// ============================================================================
...
...
@@ -587,26 +647,33 @@ void TIMIQLib::ExecuteAction(timIQConfig & cfg)
//- write "I" value
case
TI_IVAL
:
cfg
.
ti_err
=
m_timiq_hw
->
write_iValue
(
cfg
.
value
);
this
->
iVal_
end_task
();
this
->
end_task
();
// soso meme fonction end, non ?
break
;
//- write "Q" value
case
TI_QVAL
:
cfg
.
ti_err
=
m_timiq_hw
->
write_qValue
(
cfg
.
value
);
this
->
qVal_
end_task
();
this
->
end_task
();
// soso meme fonction end, non ?
break
;
//- write "DATA" value
case
TI_DATA
:
cfg
.
ti_err
=
m_timiq_hw
->
write_data
(
cfg
.
value
);
this
->
data_
end_task
();
this
->
end_task
();
// soso meme fonction end, non ?
break
;
//- write "BOARD Temperature" value
case
TI_BTEMP
:
cfg
.
ti_err
=
m_timiq_hw
->
write_data
(
cfg
.
value
);
this
->
boardT_end_task
();
break
;
this
->
end_task
();
// soso meme fonction end, non ?
break
;
//- PLL calibration -- soso add
case
TI_CALIB
:
cfg
.
ti_err
=
m_timiq_hw
->
write_command
(
RECALIBRATE_PLL
);
this
->
end_task
();
break
;
default:
break
;
}
...
...
This diff is collapsed.
Click to expand it.
src/TIMIQTypesAndConsts.h
+
3
−
1
View file @
a4de2927
...
...
@@ -105,13 +105,15 @@ typedef enum
//------------------------------
//- timIQ struct config
//------------------------------
// threaded action type
typedef
enum
{
Undef
=
0
,
TI_IVAL
,
TI_QVAL
,
TI_BTEMP
,
TI_DATA
TI_DATA
,
TI_CALIB
// soso add
}
E_ti_t
;
typedef
struct
timIQConfig
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment