-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move parameter handling to own class (#19)
This makes the source code easier to read and maintain. Signed-off-by: Joakim Roubert <[email protected]>
- Loading branch information
1 parent
93fcccf
commit c3092eb
Showing
9 changed files
with
517 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (C) 2025, Axis Communications AB, Lund, Sweden | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <axparameter.h> | ||
#include <opencv2/core/core.hpp> | ||
|
||
class ParamHandler | ||
{ | ||
public: | ||
ParamHandler(const gchar *app_name, void (*PurgeColorArea)(), void (*RestartOpcUaServer)(unsigned int)); | ||
~ParamHandler(); | ||
gboolean SetColor(const cv::Scalar color); | ||
gboolean SetResolution(const gint32 w, const gint32 h); | ||
|
||
static void ParamCallbackDouble(const gchar *name, const gchar *value, void *data); | ||
static void ParamCallbackInt(const gchar *name, const gchar *value, void *data); | ||
|
||
cv::Point GetCenterPoint() const | ||
{ | ||
return center_point_; | ||
}; | ||
cv::Scalar GetColor() const | ||
{ | ||
return color_; | ||
}; | ||
guint32 GetMarkerWidth() const | ||
{ | ||
return markerwidth_; | ||
}; | ||
guint32 GetMarkerHeight() const | ||
{ | ||
return markerheight_; | ||
}; | ||
guint8 GetMarkerShape() const | ||
{ | ||
return markershape_; | ||
}; | ||
guint8 GetTolerance() const | ||
{ | ||
return tolerance_; | ||
}; | ||
|
||
private: | ||
gboolean SetParam(const gchar *name, const gchar &value, gboolean do_sync); | ||
gboolean SetParam(const gchar *name, const gdouble value, gboolean do_sync); | ||
gboolean SetParam(const gchar *name, const gint32 value, gboolean do_sync); | ||
gchar *GetParam(const gchar *name) const; | ||
gboolean GetParam(const gchar *name, gdouble &val) const; | ||
gboolean GetParam(const gchar *name, gint32 &val) const; | ||
void UpdateLocalParam(const gchar *name, const gdouble val); | ||
void UpdateLocalParam(const gchar *name, const gint32 val); | ||
gboolean SetupParam(const gchar *name, AXParameterCallback callbackfn); | ||
gboolean SetupParamDouble(const gchar *name, AXParameterCallback callbackfn); | ||
gboolean SetupParamInt(const gchar *name, AXParameterCallback callbackfn); | ||
|
||
void (*PurgeColorArea_)(); | ||
void (*RestartOpcUaServer_)(const guint32); | ||
|
||
AXParameter *axparameter_; | ||
cv::Point center_point_; | ||
cv::Scalar color_; | ||
guint32 markerwidth_; | ||
guint32 markerheight_; | ||
guint8 markershape_; | ||
guint8 tolerance_; | ||
mutable GMutex mtx_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.