White toolbar, load optimizations.

This commit is contained in:
Robin Davies
2022-02-07 07:32:09 -05:00
parent d273f30a75
commit 01b6f801e9
28 changed files with 3996 additions and 124 deletions
+6
View File
@@ -221,6 +221,7 @@ Run the following commands to install dependent libraries required by the PiPeda
sudo apt install liblilv-dev libboost-dev libjack-jackd2-dev libnl-3-dev libnl-genl-3-dev libsystemd-dev catch
sudo apt install libasound2-dev
sudo apt install libwebsocketpp-dev authbind
sudo apt install libsdbusc++-dev libsdbusc++-bin
Run the following command to install and configure React dependencies.
@@ -354,6 +355,11 @@ You will need to add your userid to the pipedal_d group if you plan to share the
sudo usermod -a -G pipedal_d *youruserid*
You will need to add your userid to the bluetooth group if you plan to debug Bluetooth onboarding code.
sudo usermod -a -G bluetooth *youruserid*
Or you can avoid all of this, by configuring the debug instance to use a data folder in your home directory. Edit
`debugConfig/config.json`:
+384
View File
File diff suppressed because one or more lines are too long
+1625
View File
File diff suppressed because one or more lines are too long
+3
View File
@@ -139,6 +139,7 @@ add_custom_command(
public/img/fx_dial.svg
public/img/drive_file_rename_outline_black_24dp.svg
public/img/fx_filter.svg
public/img/fx_filter_hp.svg
public/img/cx_mono.svg
public/img/fx_limiter.svg
public/img/fx_converter.svg
@@ -157,6 +158,8 @@ add_custom_command(
public/img/fx_amplifier.svg
public/img/fx_plugin.svg
public/img/ic_drawer.svg
public/img/ic_drawer_2.png
public/img/fx_terminal.svg
public/img/fx_spatial.svg
public/img/fx_pitch.svg
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
<g id="Layer_1_1_" display="none">
<path display="inline" d="M47,41c0,3.313-2.688,6-6,6H7c-3.313,0-6-2.688-6-6V7c0-3.313,2.687-6,6-6h34c3.313,0,6,2.687,6,6V41z"/>
<path display="inline" fill="none" stroke="#FFFFFF" stroke-width="5" d="M-7,20.5c0,0,6.632,0,14.601,0
c7.815,0,10.993-10.467,13.093-10.467c3.335,0,5.958,26.467,36.474,26.467c10.001,0,24.833,0,24.833,0"/>
</g>
<g id="Combined">
<g>
<path d="M47.001,18V7c0-3.313-2.687-6-6-6H7C3.687,1,1,3.687,1,7v25.783c13.448-3.498,18.375-13.738,21.26-19.743
c1.594-3.316,2.646-5.507,5.047-5.507c2.028,0,3.219,1.724,4.727,3.906C33.945,14.208,36.564,18,40.4,18H47.001z"/>
<path d="M1.001,37.943V41c0,3.313,2.688,6,6,6h34c3.313,0,6-2.688,6-6V23H40.4c-6.459,0-10.229-5.458-12.48-8.719
c-0.129-0.187-0.27-0.389-0.412-0.593c-0.246,0.49-0.505,1.028-0.74,1.518C23.63,21.74,17.618,34.247,1.001,37.943z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
<g id="x">
</g>
<path d="M41,1H7C3.687,1,1,3.687,1,7v34c0,3.313,2.687,6,6,6h34c3.313,0,6-2.688,6-6V7C47,3.687,44.313,1,41,1z M19.996,38.5
c0,1.381-1.119,2.5-2.5,2.5s-2.5-1.119-2.5-2.5V8.984c0-1.381,1.119-2.5,2.5-2.5s2.5,1.119,2.5,2.5V38.5z M17.496,28.019
c-1.381,0-2.5-1.12-2.5-2.5s1.119-2.5,2.5-2.5s2.5,1.12,2.5,2.5S18.877,28.019,17.496,28.019z M29.996,38.5
c0,1.381-1.119,2.5-2.5,2.5s-2.5-1.119-2.5-2.5V8.984c0-1.381,1.119-2.5,2.5-2.5s2.5,1.119,2.5,2.5V38.5z M37.504,31.021
c-1.381,0-2.5-1.12-2.5-2.5s1.119-2.5,2.5-2.5s2.5,1.12,2.5,2.5S38.885,31.021,37.504,31.021z M40.004,38.5
c0,1.381-1.119,2.5-2.5,2.5s-2.5-1.119-2.5-2.5V8.984c0-1.381,1.119-2.5,2.5-2.5s2.5,1.119,2.5,2.5V38.5z M27.496,23.016
c-1.381,0-2.5-1.12-2.5-2.5s1.119-2.5,2.5-2.5s2.5,1.12,2.5,2.5S28.877,23.016,27.496,23.016z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

+47
View File
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="249px" height="64px" viewBox="0 0 249 64" enable-background="new 0 0 249 64" xml:space="preserve">
<path fill="#FFFFFF" stroke="#231F20" stroke-width="2" stroke-miterlimit="10" d="M204,35.183c0,7.907-6.41,14.317-14.317,14.317
H79.317C71.41,49.5,65,43.09,65,35.183v-0.365C65,26.91,71.41,20.5,79.317,20.5h110.365C197.59,20.5,204,26.91,204,34.817V35.183z"
/>
<circle fill="#BE1E2D" cx="80.767" cy="33.983" r="9.634"/>
<g>
<path d="M94.364,24.717h7.509c2.534,0,4.56,0.571,6.077,1.713c1.642,1.231,2.463,3.003,2.463,5.314
c0,2.409-0.866,4.327-2.597,5.755c-1.642,1.348-3.748,2.021-6.318,2.021H96.84v4.149h-2.476V24.717z M101.833,37.271
c1.821,0,3.257-0.455,4.31-1.365c1.098-0.945,1.646-2.279,1.646-4.002c0-1.65-0.616-2.909-1.847-3.774
c-1.106-0.776-2.592-1.165-4.457-1.165H96.84v10.307H101.833z"/>
<path d="M116.972,24.783c0,0.5-0.152,0.901-0.455,1.205c-0.303,0.303-0.705,0.455-1.205,0.455s-0.901-0.152-1.205-0.455
c-0.303-0.304-0.455-0.705-0.455-1.205c0-0.499,0.152-0.898,0.455-1.198c0.303-0.299,0.705-0.448,1.205-0.448
s0.901,0.149,1.205,0.448C116.82,23.885,116.972,24.284,116.972,24.783z M114.041,30.285h2.543V43.67h-2.543V30.285z"/>
<path d="M121.509,24.717h7.508c2.535,0,4.561,0.571,6.078,1.713c1.641,1.231,2.463,3.003,2.463,5.314
c0,2.409-0.865,4.327-2.598,5.755c-1.641,1.348-3.748,2.021-6.316,2.021h-4.659v4.149h-2.476V24.717z M128.979,37.271
c1.82,0,3.256-0.455,4.311-1.365c1.098-0.945,1.646-2.279,1.646-4.002c0-1.65-0.617-2.909-1.848-3.774
c-1.107-0.776-2.592-1.165-4.457-1.165h-4.646v10.307H128.979z"/>
<path d="M151.833,33.25c0.272,0.718,0.409,1.475,0.409,2.269s-0.09,1.727-0.269,2.797h-9.315c0.196,1.08,0.633,1.93,1.312,2.55
c0.678,0.621,1.638,0.931,2.878,0.931c1.659,0,3.181-0.303,4.564-0.91l0.428,1.914c-0.919,0.535-2.23,0.888-3.935,1.058
c-0.474,0.054-1.089,0.08-1.848,0.08s-1.553-0.151-2.383-0.455c-0.829-0.303-1.517-0.749-2.061-1.339
c-1.08-1.168-1.62-2.882-1.62-5.14c0-1.98,0.647-3.641,1.941-4.979c1.312-1.338,2.948-2.008,4.912-2.008
c1.615,0,2.904,0.482,3.868,1.446C151.188,31.936,151.562,32.531,151.833,33.25z M149.819,36.349l0.053-0.724
c0-1.633-0.611-2.717-1.833-3.252c-0.411-0.179-0.901-0.268-1.473-0.268s-1.096,0.111-1.573,0.334
c-0.477,0.224-0.89,0.527-1.237,0.91c-0.715,0.785-1.116,1.785-1.205,2.999H149.819z"/>
<path d="M165.722,42.398c-1.259,1.026-2.775,1.539-4.552,1.539c-1.918,0-3.467-0.634-4.645-1.9
c-1.151-1.231-1.727-2.829-1.727-4.792c0-2.133,0.839-3.891,2.517-5.273c1.598-1.303,3.542-1.955,5.836-1.955
c0.901,0,1.687,0.067,2.355,0.201v-7.442h2.544V43.67h-1.941L165.722,42.398z M165.507,32.479
c-0.937-0.214-1.798-0.321-2.583-0.321s-1.518,0.112-2.195,0.335c-0.678,0.224-1.268,0.545-1.767,0.964
c-1.08,0.91-1.62,2.119-1.62,3.627c0,1.321,0.349,2.423,1.044,3.307c0.741,0.937,1.728,1.405,2.959,1.405
c1.392,0,2.543-0.348,3.453-1.044c0.285-0.223,0.521-0.481,0.709-0.776V32.479z"/>
<path d="M181.716,41.957c-1.633,1.32-3.351,1.98-5.153,1.98c-1.258,0-2.315-0.33-3.172-0.99c-0.919-0.714-1.379-1.646-1.379-2.798
c0-2.373,1.579-3.957,4.738-4.752c1.276-0.321,2.807-0.499,4.592-0.535c-0.054-1.454-0.764-2.311-2.129-2.57
c-0.446-0.089-0.865-0.134-1.258-0.134s-0.741,0.019-1.044,0.054c-0.304,0.036-0.616,0.085-0.938,0.147
c-0.705,0.134-1.303,0.299-1.793,0.495l-0.71-1.9c1.249-0.625,2.758-0.938,4.524-0.938c2.757,0,4.573,0.88,5.447,2.638
c0.295,0.606,0.442,1.329,0.442,2.168v4.27c0,0.91,0.066,1.518,0.2,1.82c0.241,0.581,0.665,0.951,1.271,1.111l-0.374,1.646
C183.313,43.866,182.225,43.295,181.716,41.957z M176.904,37.492c-0.835,0.317-1.435,0.665-1.801,1.045
c-0.365,0.379-0.549,0.787-0.549,1.225s0.063,0.77,0.188,0.997s0.29,0.417,0.495,0.568c0.42,0.313,0.91,0.469,1.473,0.469
s1.068-0.061,1.52-0.181c0.45-0.12,0.867-0.278,1.251-0.476c0.75-0.374,1.37-0.838,1.861-1.392v-2.892
C179.218,36.964,177.738,37.176,176.904,37.492z"/>
<path d="M189.052,22.775h2.543v16.316c0,0.91,0.063,1.518,0.188,1.82c0.25,0.581,0.678,0.951,1.285,1.111l-0.375,1.646
c-1.383,0.179-2.369-0.188-2.958-1.098c-0.455-0.714-0.683-1.812-0.683-3.293V22.775z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

+18 -17
View File
@@ -61,14 +61,15 @@ import RenameDialog from './RenameDialog';
import JackStatusView from './JackStatusView';
const theme = createMuiTheme({
palette: {
primary: {
main: "#324c6c"
},
secondary: {
main: "#FF6060"
}
// secondary: {
// main: "#00E676"
// }
}
});
@@ -315,10 +316,10 @@ const App = withStyles(appStyles)(class extends ResizeResponsiveComponent<AppPro
this.model_ = PiPedalModelFactory.getInstance();
this.model_.zoomedUiControl.addOnChangedHandler(
()=> {
() => {
this.setState({
zoomedControlOpen: this.model_.zoomedUiControl.get() !== undefined,
zoomedControlInfo: this.model_.zoomedUiControl.get()
zoomedControlOpen: this.model_.zoomedUiControl.get() !== undefined,
zoomedControlInfo: this.model_.zoomedUiControl.get()
});
}
);
@@ -634,10 +635,10 @@ const App = withStyles(appStyles)(class extends ResizeResponsiveComponent<AppPro
<CssBaseline />
{(!this.state.tinyToolBar) ?
(
<AppBar position="absolute">
<Toolbar variant="dense" >
<AppBar position="absolute" style={{background: "white"}}>
<Toolbar variant="dense" >
<IconButton edge="start"
color="inherit" aria-label="menu" onClick={() => { this.showDrawer() }}
aria-label="menu" onClick={() => { this.showDrawer() }}
>
<MenuButton />
</IconButton>
@@ -648,7 +649,7 @@ const App = withStyles(appStyles)(class extends ResizeResponsiveComponent<AppPro
<div style={{ flex: "2 2 30px" }} />
{this.state.canFullScreen &&
<IconButton
color="inherit" aria-label="menu" onClick={() => { this.toggleFullScreen(); }}>
aria-label="menu" onClick={() => { this.toggleFullScreen(); }}>
{this.state.isFullScreen ? (
<FullscreenExitIcon />
) : (
@@ -663,13 +664,13 @@ const App = withStyles(appStyles)(class extends ResizeResponsiveComponent<AppPro
) : (
<div className={classes.toolBarContent} >
<IconButton style={{ position: "absolute", left: 12, top: 8, zIndex: 2 }}
color="inherit" aria-label="menu" onClick={() => { this.showDrawer() }}
aria-label="menu" onClick={() => { this.showDrawer() }}
>
<MenuButton />
</IconButton>
{this.state.canFullScreen && (
<IconButton style={{ position: "absolute", right: 8, top: 8, zIndex: 2 }}
color="inherit" aria-label="menu" onClick={() => { this.toggleFullScreen(); }}>
aria-label="menu" onClick={() => { this.toggleFullScreen(); }}>
{this.state.isFullScreen ? (
<FullscreenExitIcon />
) : (
@@ -784,12 +785,12 @@ const App = withStyles(appStyles)(class extends ResizeResponsiveComponent<AppPro
}
/>
<ZoomedUiControl
<ZoomedUiControl
dialogOpen={this.state.zoomedControlOpen}
controlInfo={this.state.zoomedControlInfo}
onDialogClose={()=>{ this.setState({zoomedControlOpen: false});} }
onDialogClosed={()=>{ this.model_.zoomedUiControl.set(undefined); }
}
controlInfo={this.state.zoomedControlInfo}
onDialogClose={() => { this.setState({ zoomedControlOpen: false }); }}
onDialogClosed={() => { this.model_.zoomedUiControl.set(undefined); }
}
/>
<Dialog
open={this.state.alertDialogOpen}
+4 -1
View File
@@ -61,9 +61,12 @@ export function SelectBaseIcon(plugin_type: PluginType): string {
return "fx_distortion.svg";
case PluginType.FlangerPlugin:
return "fx_flanger.svg";
case PluginType.ParaEQPlugin:
case PluginType.LowpassPlugin:
return "fx_filter.svg";
case PluginType.HighpassPlugin:
return "fx_filter_hp.svg";
case PluginType.ParaEQPlugin:
return "fx_parametric_eq.svg";
case PluginType.MultiEQPlugin:
case PluginType.EQPlugin:
return "fx_eq.svg";
+6 -5
View File
@@ -57,7 +57,7 @@ interface PresetSelectorState {
};
const selectColor = "white";
const selectColor = "black";
const styles = (theme: Theme) => createStyles({
select: { // fu fu fu.Overrides for white selector on dark background.
@@ -279,12 +279,13 @@ const PresetSelector =
let presets = this.state.presets;
let classes = this.props.classes;
return (
<div style={{ marginLeft: 12, display: "flex", flexDirection: "row", justifyContent: "left", flexWrap: "nowrap", alignItems: "center", height: "100%", position: "relative" }}>
<div style={{ marginLeft: 12, display: "flex", flexDirection: "row",
justifyContent: "left", flexWrap: "nowrap", alignItems: "center", height: "100%", position: "relative" }}>
<div style={{ flex: "1 1 auto", minWidth: 60, maxWidth: 300, position: "relative", paddingRight: 12 }} >
{true ? (
<Select
className={classes.select}
style={{ width: "100%", position: "relative", top: 0, color: "white" }} disabled={!this.state.enabled}
style={{ width: "100%", position: "relative", top: 0}} disabled={!this.state.enabled}
onChange={(e, extra) => this.handleChange(e, extra)}
onClose={(e) => this.handleSelectClose(e)}
displayEmpty
@@ -328,13 +329,13 @@ const PresetSelector =
)}
</div>
<div style={{ flex: "0 0 auto" }}>
<IconButton color="inherit" style={{ flex: "0 0 auto", opacity: this.state.presets.presetChanged ? 1.0 : 0.0 }}
<IconButton style={{ flex: "0 0 auto", opacity: this.state.presets.presetChanged ? 1.0 : 0.0 }}
onClick={(e) => { this.handleSave(); }} >
<SaveIconOutline style={{ opacity: 0.75 }} />
</IconButton>
</div>
<div style={{ flex: "0 0 auto" }}>
<IconButton color="inherit" style={{ flex: "0 0 auto" }} onClick={(e) => this.handlePresetMenuClick(e)}>
<IconButton style={{ flex: "0 0 auto" }} onClick={(e) => this.handlePresetMenuClick(e)}>
<MoreVertIcon style={{ opacity: 0.75 }} />
</IconButton>
<Menu
+4 -2
View File
@@ -95,10 +95,12 @@ export const TemporaryDrawer = withStyles(drawerStyles)(
onClick={() => { this.fireClose(); }}
onKeyDown={() => { this.fireClose(); }}
>
<Toolbar className={classes.drawer_header} style={{backgroundImage: 'url("img/ic_drawer.svg")' }} >
<Toolbar className={classes.drawer_header}
style={{backgroundImage: 'url("img/ic_drawer_2.png")', border: "red solid", borderWidth: "0px 0px 3px 0px" }}
>
<IconButton style={{ marginLeft: -24 }}
>
<ArrowBackIcon />
<ArrowBackIcon style={{ fill: '#666' }} />
</IconButton>
</Toolbar>
{this.props.children}
+39 -2
View File
@@ -36,7 +36,7 @@ const styles = (theme: Theme) => createStyles({
width: PLOT_WIDTH, height: PLOT_HEIGHT, background: "#444",
borderRadius: 6,
marginTop: 12, marginLeft: 8, marginRight: 8,
boxShadow: "1px 4px 8px #000 inset"
boxShadow: "1px 2px 4px #000 inset"
},
});
@@ -203,7 +203,7 @@ const ToobWaveShapeView =
}
toY(value: number): number {
let yMid = (this.yMin + this.yMax) / 2;
return yMid - yMid * value;
return yMid - (this.yMax-this.yMin)/2 * value;
}
toX(value: number): number {
let xMid = (this.xMin + this.xMax)/2;
@@ -358,6 +358,40 @@ const ToobWaveShapeView =
return result;
}
grid() : React.ReactNode[] {
let result : React.ReactNode[] = [];
let xMid = (this.xMin+this.xMax)/2;
let yMid = (this.yMin+this.yMax)/2;
let color = "#888";
let kx = 0;
result.push(
<line x1={this.xMin} y1={this.yMin} x2={this.xMax} y2={this.yMin} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
result.push(
<line x1={this.xMin} y1={yMid} x2={this.xMax} y2={yMid} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
result.push(
<line x1={this.xMin} y1={this.yMax} x2={this.xMax} y2={this.yMax} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
result.push(
<line x1={this.yMin} y1={this.yMin} x2={this.yMin} y2={this.yMax} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
result.push(
<line x1={xMid} y1={this.yMin} x2={xMid} y2={this.yMax} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
result.push(
<line x1={this.xMax} y1={this.yMin} x2={this.xMax} y2={this.yMax} stroke={color} strokeWidth={0.5}
key={"grid"+ kx++}/>
);
return result;
}
peakColor(value: number): string {
if (value >= 1.0 || value <= -1.0) return this.redColor;
if (value >= 0.5 || value <= -0.5) return this.yellowColor;
@@ -384,6 +418,9 @@ const ToobWaveShapeView =
return (
<div className={classes.frame} >
<svg width={PLOT_WIDTH} height={PLOT_HEIGHT} viewBox={"0 0 " + PLOT_WIDTH + " " + PLOT_HEIGHT} >
{
this.grid()
}
{ this.horizontalVuMeter(this.props.vuMin,this.props.vuMax,
this.props.vuMinPeak,this.props.vuMaxPeak)
}
+40 -6
View File
@@ -4,6 +4,15 @@ cmake_minimum_required(VERSION 3.16.0)
include(FindPkgConfig)
# apt install libsdbus-c++-dev
# apt install libsdbus-c++-bin
find_package(sdbus-c++ REQUIRED)
# Can't get the pkg_check to work.
# pkg_check_modules(LIBNL3 "nl-genl-3")
# if(!LIBNL3_FOUND)
@@ -54,10 +63,14 @@ endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set (USE_SANITIZE False)
if (CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Debug build")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG -Werror" )
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -O0 -DDEBUG -Werror" )
if (USE_SANITIZE)
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fsanitize=address -static-libasan " )
endif()
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "RelWithgDebInfo build")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
@@ -72,7 +85,20 @@ endif()
message (STATUS "Cxx flags: ${CMAKE_CXX_FLAGS}" )
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_BIND_GLOBAL_PLACEHOLDERS)
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DONBOARDING)
# build Bluez dbus proxies
# requires apt install libsdbus-c++-bin
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/src/dbus/bluez_proxy.h ${PROJECT_SOURCE_DIR}/src/dbus/bluez_adaptor.h
DEPENDS ${PROJECT_SOURCE_DIR}/src/dbus/bluez.xml
COMMAND sdbus-c++-xml2cpp ${PROJECT_SOURCE_DIR}/src/dbus/bluez.xml
--proxy=${PROJECT_SOURCE_DIR}/src/dbus/bluez_proxy.h
--adaptor=${PROJECT_SOURCE_DIR}/src/dbus/bluez_adaptor.h
COMMENT "Generating D-Bus bindings for bluez"
)
set (PIPEDAL_SOURCES
SysExec.cpp SysExec.hpp
@@ -101,7 +127,6 @@ set (PIPEDAL_SOURCES
Worker.hpp Worker.cpp
OptionsFeature.hpp OptionsFeature.cpp
VuUpdate.hpp VuUpdate.cpp
asan_options.cpp
Units.hpp Units.cpp
RingBuffer.hpp
PiPedalConfiguration.hpp PiPedalConfiguration.cpp
@@ -119,12 +144,15 @@ set (PIPEDAL_SOURCES
WifiChannels.cpp
RegDb.cpp RegDb.hpp
PiPedalAlsa.hpp PiPedalAlsa.cpp
InheritPriorityMutex.hpp InheritPriorityMutex.cpp
)
configure_file(config.hpp.in config.hpp)
#################################
add_executable(pipedald ${PIPEDAL_SOURCES} main.cpp
add_executable(pipedald ${PIPEDAL_SOURCES}
asan_options.cpp # disable leak checking for sanitize=address.
main.cpp
)
include_directories( ${pipedald_SOURCE_DIR}/. ../build/src)
@@ -138,18 +166,24 @@ target_include_directories(pipedald PRIVATE
)
target_link_libraries(pipedald PRIVATE pthread atomic stdc++fs asound
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd SDBusCpp::sdbus-c++
)
#################################
add_executable(pipedaltest ${PIPEDAL_SOURCES} testMain.cpp
dbus/bluez_proxy.h dbus/bluez_adaptor.h
dbus/bluez_test.cpp
jsonTest.cpp
WifiChannelsTest.cpp
PiPedalAlsaTest.cpp
Lv2HostLeakTest.cpp
SystemConfigFile.hpp SystemConfigFile.cpp
SystemConfigFileTest.cpp
BeastServerTest.cpp
MemDebug.cpp
)
configure_file(config.hpp.in config.hpp)
@@ -164,7 +198,7 @@ target_include_directories(pipedaltest PRIVATE
)
target_link_libraries(pipedaltest PRIVATE pthread atomic stdc++fs asound
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd
${LILV_0_LIBRARIES} ${JACK_LIBRARIES} ${LIBNL3_LIBRARIES} systemd SDBusCpp::sdbus-c++
)
#################################
+5
View File
@@ -302,6 +302,11 @@ void InstallJackService()
// sysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
sysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
// If ONBOARDING, add to bluetooth group.
#ifdef ONBOARDING
sysExec(USERMOD_BIN " -a -G bluetooth " JACK_SERVICE_ACCOUNT_NAME);
#endif
// deploy the systemd service file
std::map<std::string, std::string> map; // nothing to customize.
+24
View File
@@ -0,0 +1,24 @@
#include "InheritPriorityMutex.hpp"
using namespace pipedal;
using namespace std;
inherit_priority_recursive_mutex::inherit_priority_recursive_mutex()
{
#ifdef __linux__ // (I think windows mutexes have priority inheritance alread)
// Recreate the raw mutex with priory inheritance.
::pthread_mutex_destroy(native_handle());
::pthread_mutexattr_t attr;
::pthread_mutexattr_init(&attr);
::pthread_mutexattr_setprotocol(&attr,PTHREAD_PRIO_INHERIT);
::pthread_mutex_init(native_handle(),&attr);
::pthread_mutexattr_destroy(&attr);
#endif
}
+32
View File
@@ -0,0 +1,32 @@
// Copyright (c) 2021 Robin Davies
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#pragma once
#include <mutex>
namespace pipedal {
using namespace std;
class inherit_priority_recursive_mutex: public recursive_mutex {
public:
inherit_priority_recursive_mutex();
};
}; // namespace
+3 -2
View File
@@ -44,6 +44,7 @@ using namespace pipedal;
#include <chrono>
#include <fstream>
#include "Lv2EventBufferWriter.hpp"
#include "InheritPriorityMutex.hpp"
#ifdef __linux__
#include <sched.h>
@@ -115,7 +116,7 @@ class JackHostImpl : public JackHost
{
private:
std::recursive_mutex mutex;
inherit_priority_recursive_mutex mutex;
int64_t overrunGracePeriodSamples = 0;
IJackHostCallbacks *pNotifyCallbacks = nullptr;
@@ -1388,7 +1389,7 @@ private:
std::vector<RestartThread *> restartThreads;
public:
std::recursive_mutex restart_mutex;
inherit_priority_recursive_mutex restart_mutex;
virtual void UpdateServerConfiguration(const JackServerSettings &jackServerSettings,
std::function<void(bool success, const std::string &errorMessage)> onComplete)
{
+97 -88
View File
@@ -93,6 +93,52 @@ namespace pipedal
};
}
void Lv2Host::LilvUris::Initialize(LilvWorld*pWorld)
{
rdfsComment = lilv_new_uri(pWorld, Lv2Host::RDFS_COMMENT_URI);
logarithic_uri = lilv_new_uri(pWorld, LV2_PORT_LOGARITHMIC);
display_priority_uri = lilv_new_uri(pWorld, LV2_PORT_DISPLAY_PRIORITY);
range_steps_uri = lilv_new_uri(pWorld, LV2_PORT_RANGE_STEPS);
integer_property_uri = lilv_new_uri(pWorld, LV2_INTEGER);
enumeration_property_uri = lilv_new_uri(pWorld, LV2_ENUMERATION);
toggle_property_uri = lilv_new_uri(pWorld, LV2_CORE__toggled);
not_on_gui_property_uri = lilv_new_uri(pWorld, LV2_PORT_PROPS__notOnGUI);
midiEventNode = lilv_new_uri(pWorld, LV2_MIDI_EVENT);
designationNode = lilv_new_uri(pWorld, LV2_DESIGNATION);
portGroupUri = lilv_new_uri(pWorld, LV2_PORT_GROUPS__group);
unitsUri = lilv_new_uri(pWorld, LV2_UNITS__unit);
bufferType_uri = lilv_new_uri(pWorld, LV2_ATOM__bufferType);
pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
symbolUri = lilv_new_uri(pWorld, LV2_CORE__symbol);
nameUri = lilv_new_uri(pWorld, LV2_CORE__name);
}
void Lv2Host::LilvUris::Free()
{
rdfsComment.Free();
logarithic_uri.Free();
display_priority_uri.Free();
range_steps_uri.Free();
integer_property_uri.Free();
enumeration_property_uri.Free();
toggle_property_uri.Free();
not_on_gui_property_uri.Free();
midiEventNode.Free();
designationNode.Free();
portGroupUri.Free();
unitsUri.Free();
bufferType_uri.Free();
pset_Preset.Free();
rdfs_label.Free();
symbolUri.Free();
nameUri.Free();
}
static std::string nodeAsString(const LilvNode *node)
{
if (node == nullptr)
@@ -134,11 +180,11 @@ static float nodeAsFloat(const LilvNode *node, float default_ = 0)
return default_;
}
class NodeAutoFree
class NodeAutoFree: public LilvNodePtr
{
LilvNode *node = nullptr;
// const LilvNode* returns must not be freed, by convention.
private:
NodeAutoFree(const LilvNode *node)
{
}
@@ -146,25 +192,10 @@ class NodeAutoFree
public:
NodeAutoFree()
{
this->node = nullptr;
}
NodeAutoFree(LilvNode *node)
:LilvNodePtr(node)
{
this->node = node;
}
operator const LilvNode *()
{
return this->node;
}
LilvNode **operator&()
{
return &(this->node);
}
operator bool()
{
return this->node != nullptr;
}
float as_float(float defaultValue = 0)
@@ -194,11 +225,6 @@ public:
~NodeAutoFree()
{
if (this->node != nullptr)
{
lilv_free(this->node);
this->node = nullptr;
}
}
};
@@ -235,6 +261,7 @@ void Lv2Host::OnConfigurationChanged(const JackConfiguration &configuration, con
Lv2Host::~Lv2Host()
{
delete[] lv2Features;
lilvUris.Free();
free_world();
delete urids;
}
@@ -290,21 +317,21 @@ std::shared_ptr<Lv2PluginClass> Lv2Host::GetPluginClass(const LilvPluginClass *p
std::shared_ptr<Lv2PluginClass> Lv2Host::MakePluginClass(const LilvPluginClass *pClass)
{
std::string uri = nodeAsString(lilv_plugin_class_get_uri(pClass));
std::shared_ptr<Lv2PluginClass> pResult = this->classesMap[uri];
if (!pResult)
auto t = this->classesMap.find(uri);
if (t != classesMap.end())
{
const LilvNode *parentNode = lilv_plugin_class_get_parent_uri(pClass);
std::string parent_uri = nodeAsString(parentNode);
std::string name = nodeAsString(lilv_plugin_class_get_label(pClass));
std::shared_ptr<Lv2PluginClass> result = std::make_shared<Lv2PluginClass>(
name.c_str(), uri.c_str(), parent_uri.c_str());
classesMap[uri] = std::move(result);
return t->second;
}
return pResult;
const LilvNode *parentNode = lilv_plugin_class_get_parent_uri(pClass);
std::string parent_uri = nodeAsString(parentNode);
std::string name = nodeAsString(lilv_plugin_class_get_label(pClass));
std::shared_ptr<Lv2PluginClass> result = std::make_shared<Lv2PluginClass>(
name.c_str(), uri.c_str(), parent_uri.c_str());
classesMap[uri] = result;
return result;
}
void Lv2Host::LoadPluginClassesFromLilv()
@@ -352,6 +379,7 @@ void Lv2Host::Load(const char *lv2Path)
pWorld = lilv_world_new();
lilv_world_load_all(pWorld);
lilvUris.Initialize(pWorld);
const LilvPlugins *plugins = lilv_world_get_all_plugins(pWorld);
@@ -465,14 +493,13 @@ static std::vector<std::string> nodeAsStringArray(const LilvNodes *nodes)
return result;
}
static const char *RDFS_COMMENT_URI = "http://www.w3.org/2000/01/rdf-schema#"
const char *Lv2Host::RDFS_COMMENT_URI = "http://www.w3.org/2000/01/rdf-schema#"
"comment";
static LilvNode *get_comment(LilvWorld *pWorld, const std::string &uri)
LilvNode *Lv2Host::get_comment(const std::string &uri)
{
NodeAutoFree uriNode = lilv_new_uri(pWorld, uri.c_str());
NodeAutoFree rdfsComment = lilv_new_uri(pWorld, RDFS_COMMENT_URI);
LilvNode *result = lilv_world_get(pWorld, uriNode, rdfsComment, nullptr);
LilvNode *result = lilv_world_get(pWorld, uriNode, lilvUris.rdfsComment, nullptr);
return result;
}
@@ -509,7 +536,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
NodesAutoFree extensions = lilv_plugin_get_extension_data(pPlugin);
this->extensions_ = nodeAsStringArray(extensions);
NodeAutoFree comment = get_comment(lv2Host->pWorld, this->uri_);
NodeAutoFree comment = lv2Host->get_comment(this->uri_);
this->comment_ = nodeAsString(comment);
uint32_t ports = lilv_plugin_get_num_ports(pPlugin);
@@ -521,7 +548,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
{
const LilvPort *pPort = lilv_plugin_get_port_by_index(pPlugin, i);
std::shared_ptr<Lv2PortInfo> portInfo{new Lv2PortInfo(lv2Host, pPlugin, pPort)};
std::shared_ptr<Lv2PortInfo> portInfo = std::make_shared<Lv2PortInfo>(lv2Host, pPlugin, pPort);
if (!portInfo->is_valid())
{
isValid = false;
@@ -550,6 +577,7 @@ Lv2PluginInfo::Lv2PluginInfo(Lv2Host *lv2Host, const LilvPlugin *pPlugin)
isValid = false;
}
}
std::sort(ports_.begin(), ports_.end(), ports_sort_compare);
this->is_valid_ = isValid;
}
@@ -602,16 +630,16 @@ static bool scale_points_sort_compare(const Lv2ScalePoint &v1, const Lv2ScalePoi
{
return v1.value() < v2.value();
}
Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvPort *pPort)
Lv2PortInfo::Lv2PortInfo(Lv2Host *host, const LilvPlugin *plugin, const LilvPort *pPort)
{
auto pWorld = plugins->pWorld;
auto pWorld = host->pWorld;
index_ = lilv_port_get_index(plugin, pPort);
symbol_ = nodeAsString(lilv_port_get_symbol(plugin, pPort));
NodeAutoFree name = lilv_port_get_name(plugin, pPort);
name_ = nodeAsString(name);
classes_ = plugins->GetPluginPortClass(plugin, pPort);
classes_ = host->GetPluginPortClass(plugin, pPort);
NodeAutoFree minNode, maxNode, defaultNode;
min_value_ = 0;
@@ -635,11 +663,9 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
if (default_value_ < min_value_)
default_value_ = min_value_;
NodeAutoFree logarithic_uri = lilv_new_uri(pWorld, LV2_PORT_LOGARITHMIC);
this->is_logarithmic_ = lilv_port_has_property(plugin, pPort, logarithic_uri);
this->is_logarithmic_ = lilv_port_has_property(plugin, pPort, host->lilvUris.logarithic_uri);
NodeAutoFree display_priority_uri = lilv_new_uri(pWorld, LV2_PORT_DISPLAY_PRIORITY);
NodesAutoFree priority_nodes = lilv_port_get_value(plugin, pPort, display_priority_uri);
NodesAutoFree priority_nodes = lilv_port_get_value(plugin, pPort, host->lilvUris.display_priority_uri);
this->display_priority_ = -1;
if (priority_nodes)
@@ -651,8 +677,7 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
}
}
NodeAutoFree range_steps_uri = lilv_new_uri(pWorld, LV2_PORT_RANGE_STEPS);
NodesAutoFree range_steps_nodes = lilv_port_get_value(plugin, pPort, range_steps_uri);
NodesAutoFree range_steps_nodes = lilv_port_get_value(plugin, pPort, host->lilvUris.range_steps_uri);
this->range_steps_ = 0;
if (range_steps_nodes)
{
@@ -662,17 +687,13 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
this->range_steps_ = lilv_node_as_int(range_steps_node);
}
}
NodeAutoFree integer_property_uri = lilv_new_uri(pWorld, LV2_INTEGER);
this->integer_property_ = lilv_port_has_property(plugin, pPort, integer_property_uri);
this->integer_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.integer_property_uri);
NodeAutoFree enumeration_property_uri = lilv_new_uri(pWorld, LV2_ENUMERATION);
this->enumeration_property_ = lilv_port_has_property(plugin, pPort, enumeration_property_uri);
this->enumeration_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.enumeration_property_uri);
NodeAutoFree toggle_property_uri = lilv_new_uri(pWorld, LV2_CORE__toggled);
this->toggled_property_ = lilv_port_has_property(plugin, pPort, toggle_property_uri);
this->toggled_property_ = lilv_port_has_property(plugin, pPort, host->lilvUris.toggle_property_uri);
NodeAutoFree not_on_gui_property_uri = lilv_new_uri(pWorld, LV2_PORT_PROPS__notOnGUI);
this->not_on_gui_ = lilv_port_has_property(plugin, pPort, not_on_gui_property_uri);
this->not_on_gui_ = lilv_port_has_property(plugin, pPort, host->lilvUris.not_on_gui_property_uri);
LilvScalePoints *pScalePoints = lilv_port_get_scale_points(plugin, pPort);
LILV_FOREACH(scale_points, iSP, pScalePoints)
@@ -688,32 +709,27 @@ Lv2PortInfo::Lv2PortInfo(Lv2Host *plugins, const LilvPlugin *plugin, const LilvP
std::sort(scale_points_.begin(), scale_points_.end(), scale_points_sort_compare);
is_input_ = is_a(plugins, LV2_INPUT_PORT);
is_output_ = is_a(plugins, LV2_OUTPUT_PORT);
is_input_ = is_a(host, LV2_INPUT_PORT);
is_output_ = is_a(host, LV2_OUTPUT_PORT);
is_control_port_ = is_a(plugins, LV2_CORE__ControlPort);
is_audio_port_ = is_a(plugins, LV2_CORE__AudioPort);
is_atom_port_ = is_a(plugins, LV2_ATOM_PORT);
is_cv_port_ = is_a(plugins, LV2_CORE__CVPort);
is_control_port_ = is_a(host, LV2_CORE__ControlPort);
is_audio_port_ = is_a(host, LV2_CORE__AudioPort);
is_atom_port_ = is_a(host, LV2_ATOM_PORT);
is_cv_port_ = is_a(host, LV2_CORE__CVPort);
NodeAutoFree midiEventNode = lilv_new_uri(plugins->pWorld, LV2_MIDI_EVENT);
supports_midi_ = lilv_port_supports_event(plugin, pPort, midiEventNode);
supports_midi_ = lilv_port_supports_event(plugin, pPort, host->lilvUris.midiEventNode);
NodeAutoFree designationNode = lilv_new_uri(plugins->pWorld, LV2_DESIGNATION);
NodeAutoFree designationValue = lilv_port_get(plugin, pPort, designationNode);
NodeAutoFree designationValue = lilv_port_get(plugin, pPort, host->lilvUris.designationNode);
designation_ = nodeAsString(designationValue);
NodeAutoFree portGroupUri = lilv_new_uri(plugins->pWorld, LV2_PORT_GROUPS__group);
NodeAutoFree portGroup_value = lilv_port_get(plugin, pPort, portGroupUri);
NodeAutoFree portGroup_value = lilv_port_get(plugin, pPort, host->lilvUris.portGroupUri);
port_group_ = nodeAsString(portGroup_value);
NodeAutoFree unitsUri = lilv_new_uri(plugins->pWorld, LV2_UNITS__unit);
NodeAutoFree unitsValueUri = lilv_port_get(plugin, pPort, unitsUri);
NodeAutoFree unitsValueUri = lilv_port_get(plugin, pPort, host->lilvUris.unitsUri);
this->units_ = UriToUnits(nodeAsString(unitsValueUri));
NodeAutoFree bufferType_uri = lilv_new_uri(pWorld, LV2_ATOM__bufferType);
NodeAutoFree bufferType = lilv_port_get(plugin, pPort, bufferType_uri);
NodeAutoFree bufferType = lilv_port_get(plugin, pPort, host->lilvUris.bufferType_uri);
this->buffer_type_ = "";
if (bufferType)
@@ -920,11 +936,8 @@ std::vector<ControlValue> Lv2Host::LoadPluginPreset(PedalBoardItem*pedalBoardIte
throw PiPedalStateException("No such plugin.");
}
NodeAutoFree pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
NodeAutoFree rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
LilvNodes* presets = lilv_plugin_get_related(plugin, pset_Preset);
LilvNodes* presets = lilv_plugin_get_related(plugin, lilvUris.pset_Preset);
LILV_FOREACH(nodes, i, presets) {
const LilvNode* preset = lilv_nodes_get(presets, i);
lilv_world_load_resource(pWorld, preset);
@@ -980,17 +993,15 @@ std::vector<Lv2PluginPreset> Lv2Host::GetPluginPresets(const std::string &plugin
throw PiPedalStateException("No such plugin.");
}
NodeAutoFree pset_Preset = lilv_new_uri(pWorld, LV2_PRESETS__Preset);
NodeAutoFree rdfs_label = lilv_new_uri(pWorld, LILV_NS_RDFS "label");
LilvNodes* presets = lilv_plugin_get_related(plugin, pset_Preset);
LilvNodes* presets = lilv_plugin_get_related(plugin, lilvUris.pset_Preset);
LILV_FOREACH(nodes, i, presets) {
const LilvNode* preset = lilv_nodes_get(presets, i);
lilv_world_load_resource(pWorld, preset);
LilvNodes* labels = lilv_world_find_nodes(
pWorld, preset, rdfs_label, NULL);
pWorld, preset, lilvUris.rdfs_label, NULL);
if (labels) {
const LilvNode* label = lilv_nodes_get_first(labels);
std::string presetName = nodeAsString(label);
@@ -1035,13 +1046,11 @@ Lv2PortGroup::Lv2PortGroup(Lv2Host *lv2Host, const std::string &groupUri)
{
LilvWorld *pWorld = lv2Host->pWorld;
NodeAutoFree symbolUri = lilv_new_uri(pWorld, LV2_CORE__symbol);
NodeAutoFree nameUri = lilv_new_uri(pWorld, LV2_CORE__name);
this->uri_ = groupUri;
NodeAutoFree uri = lilv_new_uri(pWorld, groupUri.c_str());
LilvNode *symbolNode = lilv_world_get(pWorld, uri, symbolUri, nullptr);
LilvNode *symbolNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris.symbolUri, nullptr);
symbol_ = nodeAsString(symbolNode);
LilvNode *nameNode = lilv_world_get(pWorld, uri, nameUri, nullptr);
LilvNode *nameNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris.nameUri, nullptr);
name_ = nodeAsString(nameNode);
}
+67 -1
View File
@@ -100,6 +100,13 @@ private:
this->parent_ = parent.get();
}
void add_child(std::shared_ptr<Lv2PluginClass> &child) {
for (size_t i = 0; i < children_.size(); ++i)
{
if (children_[i]->uri_ == child->uri_)
{
return;
}
}
children_.push_back(child);
}
public:
@@ -180,9 +187,10 @@ enum class Lv2BufferType {
};
class Lv2PortInfo {
public:
Lv2PortInfo(Lv2Host*lv2Host,const LilvPlugin*pPlugin,const LilvPort *pPort);
private:
friend class Lv2PluginInfo;
Lv2PortInfo(Lv2Host*lv2Host,const LilvPlugin*pPlugin,const LilvPort *pPort);
uint32_t index_;
std::string symbol_;
@@ -536,8 +544,66 @@ public:
virtual Lv2Effect*CreateEffect(const PedalBoardItem &pedalBoard) = 0;
};
class LilvNodePtr {
protected:
LilvNode *node = nullptr;
LilvNodePtr(const LilvNodePtr&) {}; // no copy.
LilvNodePtr(const LilvNode*) {}; // const LilvNodes are owned by lilv by convention.
public:
LilvNodePtr() { }
LilvNodePtr(LilvNode*node) { this->node = node; }
~LilvNodePtr() { Free(); }
void Free() { if (node != nullptr) lilv_node_free(node); node = nullptr;}
operator const LilvNode *()
{
return this->node;
}
LilvNode **operator&()
{
return &(this->node);
}
operator bool()
{
return this->node != nullptr;
}
LilvNodePtr&operator=(LilvNode*node) { Free(); this->node = node; return *this;}
};
class Lv2Host: private IHost {
private:
static const char *RDFS_COMMENT_URI;
class LilvUris {
public:
void Initialize(LilvWorld*pWorld);
void Free();
LilvNodePtr rdfsComment;
LilvNodePtr logarithic_uri;
LilvNodePtr display_priority_uri;
LilvNodePtr range_steps_uri;
LilvNodePtr integer_property_uri;
LilvNodePtr enumeration_property_uri;
LilvNodePtr toggle_property_uri;
LilvNodePtr not_on_gui_property_uri;
LilvNodePtr midiEventNode;
LilvNodePtr designationNode;
LilvNodePtr portGroupUri;
LilvNodePtr unitsUri;
LilvNodePtr bufferType_uri;
LilvNodePtr pset_Preset;
LilvNodePtr rdfs_label;
LilvNodePtr symbolUri;
LilvNodePtr nameUri;
};
LilvUris lilvUris;
LilvNode *get_comment(const std::string &uri);
size_t maxBufferSize = 1024;
size_t maxAtomBufferSize = 16*1024;
bool hasMidiInputChannel;
+37
View File
@@ -0,0 +1,37 @@
// Copyright (c) 2021 Robin Davies
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pch.h"
#include "catch.hpp"
#include <sstream>
#include <cstdint>
#include <string>
#include "Lv2Host.hpp"
using namespace pipedal;
TEST_CASE( "Lv2Host memory leak", "[lv2host_leak]" ) {
Lv2Host host;
host.Load("/usr/lib/lv2:/usr/local/lib/lv2:/usr/modep/lv2");
}
+69
View File
@@ -0,0 +1,69 @@
#include "stdlib.h"
#include <mutex>
#ifdef DEBUG
static std::mutex memMutex;
struct MemStats {
size_t allocated = 0;
size_t allocations = 0;
};
MemStats memStats;
void *operator new(size_t size)
{
{
std::lock_guard lock(memMutex);
memStats.allocated += size;
memStats.allocations++;
}
char *p = (char*)malloc(size+8);
((size_t*)p)[0] = size;
return p+8;
}
void operator delete(void*mem)
{
char *p = ((char*)mem);
size_t size = *(size_t*)(p-8);
{
std::lock_guard lock(memMutex);
memStats.allocated -= size;
memStats.allocations--;
}
free(p-8);
}
void* operator new[](size_t size)
{
{
std::lock_guard lock(memMutex);
memStats.allocated += size;
memStats.allocations++;
}
char *p = (char*)malloc(size+8);
((size_t*)p)[0] = size;
return p+8;
}
void operator delete[](void*mem)
{
char *p = ((char*)mem);
size_t size = *(size_t*)(p-8);
{
std::lock_guard lock(memMutex);
memStats.allocated -= size;
memStats.allocations--;
}
free(p-8);
}
#endif
+28
View File
@@ -0,0 +1,28 @@
#include "bluez_proxy.h"
namespace org { namespace bluez {
using BleDevice_Interfaces = sdbus::ProxyInterfaces<
org::bluez::LEAdvertisingManager1_proxy,
org::bluez::NetworkServer1_proxy,
org::bluez::GattManager1_proxy
>;
class BleDeviceProxy : public BleDevice_Interfaces
{
public:
BleDeviceProxy(std::string destination, std::string path)
: BleDevice_Interfaces(std::move(destination),std::move(path))
{
registerProxy();
}
~BleDeviceProxy()
{
unregisterProxy();
}
};
}}; // namesapce
+276
View File
@@ -0,0 +1,276 @@
<!--
Copyright 2015 Intel Corporation All Rights Reserved.
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.
******************************************************************
The introspection XML found in this file is used to generate GDBus
skeleton code that will be used by the IoTivity BlueZ-based GATT
Service (OIC Transport Profile) implementation.
See the GATT and LE Advertisement API documentation in the BlueZ
gatt-api.txt and advertisement-api.txt documents, respectively for
further details.
-->
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/org/pipedald/gatt/service">
<!--
***********************************************
BlueZ GATT Service interface introspection XML.
***********************************************
-->
<interface name="org.bluez.GattService1">
<property name="UUID" type="s" access="read"/>
<property name="Primary" type="b" access="read"/>
<property name="Characteristics" type="ao" access="read"/>
<!--
===========================================================
The "Device" property is only exposed on the client side by
BlueZ itself. It isn't set by the IoTivity server side.
Don't bother generating skeleton code for it.
===========================================================
<property name="Device" type="o" access="read">
</property>
===========================================================
The "Includes" property is not supported as of BlueZ 5.30.
It also isn't used by the IoTivity server side
implementation. Don't bother generating skeleton code for
it.
===========================================================
<property name="Includes" type="ao" access="read"/>
-->
</interface>
<!--
******************************************************
BlueZ GATT Characteristic interface introspection XML.
******************************************************
-->
<interface name="org.bluez.GattCharacteristic1">
<!--
============================================================
None of the OIC GATT characteristics support the "ReadValue"
method. Don't bother generating skeleton code for it.
============================================================
<method name="ReadValue">
<arg name="value" type="ay" direction="out"/>
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</method>
-->
<method name="WriteValue">
<arg name="value" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
<method name="StartNotify"/>
<method name="StopNotify"/>
<property name="UUID" type="s" access="read"/>
<property name="Service" type="o" access="read"/>
<property name="Value" type="ay" access="read">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</property>
<property name="Notifying" type="b" access="read">
</property>
<property name="Flags" type="as" access="read"/>
<property name="Descriptors" type="ao" access="read"/>
</interface>
<!--
**************************************************
BlueZ GATT Descriptor interface introspection XML.
**************************************************
-->
<interface name="org.bluez.GattDescriptor1">
<method name="ReadValue">
<arg name="value" type="ay" direction="out">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
<!--
============================================================
None of the OIC GATT descriptors directly supported by
IoTivity support the "WriteValue" method. The OIC Client
Characteristic Configuration Descriptor supports writes, but
that descriptor is handled by BlueZ, not IoTivity, when the
"notify" property is set on a given GATT characteristic.
Don't bother generating skeleton code for it.
============================================================
<method name="WriteValue">
<arg name="value" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
-->
<property name="UUID" type="s" access="read"/>
<property name="Characteristic" type="o" access="read"/>
<property name="Value" type="ay" access="read">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</property>
<property name="Flags" type="as" access="read"/>
</interface>
<!--
***************************************************
BlueZ LE Advertisement interface introspection XML.
***************************************************
-->
<interface name="org.bluez.LEAdvertisement1">
<method name="Release">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<property name="Type" type="s" access="read"/>
<property name="ServiceUUIDs" type="as" access="read"/>
<property name="ManufacturerData" type="a{sv}" access="read"/>
<property name="SolicitUUIDs" type="as" access="read"/>
<property name="ServiceData" type="a{sv}" access="read"/>
<property name="IncludeTxPower" type="b" access="read"/>
</interface>
<!--
**************************************
BlueZ LE instance interfaces.
**************************************
-->
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
<interface name="org.bluez.Adapter1">
<method name="StartDiscovery"></method>
<method name="SetDiscoveryFilter">
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="StopDiscovery"></method>
<method name="RemoveDevice">
<arg name="device" type="o" direction="in"/>
</method>
<method name="GetDiscoveryFilters">
<arg name="filters" type="as" direction="out"/>
</method>
<property name="Address" type="s" access="read"></property>
<property name="AddressType" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
<property name="Class" type="u" access="read"></property>
<property name="Powered" type="b" access="readwrite"></property>
<property name="Discoverable" type="b" access="readwrite"></property>
<property name="DiscoverableTimeout" type="u" access="readwrite"></property>
<property name="Pairable" type="b" access="readwrite"></property>
<property name="PairableTimeout" type="u" access="readwrite"></property>
<property name="Discovering" type="b" access="read"></property>
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Roles" type="as" access="read"></property>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.bluez.GattManager1">
<method name="RegisterApplication">
<arg name="application" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterApplication">
<arg name="application" type="o" direction="in"/>
</method>
</interface>
<interface name="org.bluez.LEAdvertisingManager1">
<method name="RegisterAdvertisement">
<arg name="advertisement" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterAdvertisement">
<arg name="service" type="o" direction="in"/>
</method>
<property name="ActiveInstances" type="y" access="read"></property>
<property name="SupportedInstances" type="y" access="read"></property>
<property name="SupportedIncludes" type="as" access="read"></property>
<property name="SupportedSecondaryChannels" type="as" access="read"></property>
</interface>
<interface name="org.bluez.Media1">
<method name="RegisterEndpoint">
<arg name="endpoint" type="o" direction="in"/>
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterEndpoint">
<arg name="endpoint" type="o" direction="in"/>
</method>
<method name="RegisterPlayer">
<arg name="player" type="o" direction="in"/>
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterPlayer">
<arg name="player" type="o" direction="in"/>
</method>
<method name="RegisterApplication">
<arg name="application" type="o" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method>
<method name="UnregisterApplication">
<arg name="application" type="o" direction="in"/>
</method>
</interface>
<interface name="org.bluez.NetworkServer1">
<method name="Register">
<arg name="uuid" type="s" direction="in"/>
<arg name="bridge" type="s" direction="in"/>
</method>
<method name="Unregister">
<arg name="uuid" type="s" direction="in"/>
</method>
</interface>
</node>
+428
View File
@@ -0,0 +1,428 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_adaptor_h__adaptor__H__
#define __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_adaptor_h__adaptor__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace bluez {
class GattService1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattService1";
protected:
GattService1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Primary").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Primary(); });
object_.registerProperty("Characteristics").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Characteristics(); });
}
~GattService1_adaptor() = default;
private:
virtual std::string UUID() = 0;
virtual bool Primary() = 0;
virtual std::vector<sdbus::ObjectPath> Characteristics() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattCharacteristic1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattCharacteristic1";
protected:
GattCharacteristic1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("WriteValue").onInterface(INTERFACE_NAME).withInputParamNames("value").implementedAs([this](const std::vector<uint8_t>& value){ return this->WriteValue(value); });
object_.registerMethod("StartNotify").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StartNotify(); });
object_.registerMethod("StopNotify").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StopNotify(); });
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Service").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Service(); });
object_.registerProperty("Value").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Value(); });
object_.registerProperty("Notifying").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Notifying(); });
object_.registerProperty("Flags").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Flags(); });
object_.registerProperty("Descriptors").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Descriptors(); });
}
~GattCharacteristic1_adaptor() = default;
private:
virtual void WriteValue(const std::vector<uint8_t>& value) = 0;
virtual void StartNotify() = 0;
virtual void StopNotify() = 0;
private:
virtual std::string UUID() = 0;
virtual sdbus::ObjectPath Service() = 0;
virtual std::vector<uint8_t> Value() = 0;
virtual bool Notifying() = 0;
virtual std::vector<std::string> Flags() = 0;
virtual std::vector<sdbus::ObjectPath> Descriptors() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattDescriptor1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattDescriptor1";
protected:
GattDescriptor1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("ReadValue").onInterface(INTERFACE_NAME).withOutputParamNames("value").implementedAs([this](){ return this->ReadValue(); });
object_.registerProperty("UUID").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUID(); });
object_.registerProperty("Characteristic").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Characteristic(); });
object_.registerProperty("Value").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Value(); });
object_.registerProperty("Flags").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Flags(); });
}
~GattDescriptor1_adaptor() = default;
private:
virtual std::vector<uint8_t> ReadValue() = 0;
private:
virtual std::string UUID() = 0;
virtual sdbus::ObjectPath Characteristic() = 0;
virtual std::vector<uint8_t> Value() = 0;
virtual std::vector<std::string> Flags() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisement1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisement1";
protected:
LEAdvertisement1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Release").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->Release(); }).withNoReply();
object_.registerProperty("Type").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Type(); });
object_.registerProperty("ServiceUUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ServiceUUIDs(); });
object_.registerProperty("ManufacturerData").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ManufacturerData(); });
object_.registerProperty("SolicitUUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SolicitUUIDs(); });
object_.registerProperty("ServiceData").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ServiceData(); });
object_.registerProperty("IncludeTxPower").onInterface(INTERFACE_NAME).withGetter([this](){ return this->IncludeTxPower(); });
}
~LEAdvertisement1_adaptor() = default;
private:
virtual void Release() = 0;
private:
virtual std::string Type() = 0;
virtual std::vector<std::string> ServiceUUIDs() = 0;
virtual std::map<std::string, sdbus::Variant> ManufacturerData() = 0;
virtual std::vector<std::string> SolicitUUIDs() = 0;
virtual std::map<std::string, sdbus::Variant> ServiceData() = 0;
virtual bool IncludeTxPower() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Introspectable_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Introspectable";
protected:
Introspectable_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Introspect").onInterface(INTERFACE_NAME).withOutputParamNames("xml").implementedAs([this](){ return this->Introspect(); });
}
~Introspectable_adaptor() = default;
private:
virtual std::string Introspect() = 0;
private:
sdbus::IObject& object_;
};
}}} // namespaces
namespace org {
namespace bluez {
class Adapter1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Adapter1";
protected:
Adapter1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("StartDiscovery").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StartDiscovery(); });
object_.registerMethod("SetDiscoveryFilter").onInterface(INTERFACE_NAME).withInputParamNames("properties").implementedAs([this](const std::map<std::string, sdbus::Variant>& properties){ return this->SetDiscoveryFilter(properties); });
object_.registerMethod("StopDiscovery").onInterface(INTERFACE_NAME).implementedAs([this](){ return this->StopDiscovery(); });
object_.registerMethod("RemoveDevice").onInterface(INTERFACE_NAME).withInputParamNames("device").implementedAs([this](const sdbus::ObjectPath& device){ return this->RemoveDevice(device); });
object_.registerMethod("GetDiscoveryFilters").onInterface(INTERFACE_NAME).withOutputParamNames("filters").implementedAs([this](){ return this->GetDiscoveryFilters(); });
object_.registerProperty("Address").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Address(); });
object_.registerProperty("AddressType").onInterface(INTERFACE_NAME).withGetter([this](){ return this->AddressType(); });
object_.registerProperty("Name").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Name(); });
object_.registerProperty("Alias").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Alias(); }).withSetter([this](const std::string& value){ this->Alias(value); });
object_.registerProperty("Class").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Class(); });
object_.registerProperty("Powered").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Powered(); }).withSetter([this](const bool& value){ this->Powered(value); });
object_.registerProperty("Discoverable").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Discoverable(); }).withSetter([this](const bool& value){ this->Discoverable(value); });
object_.registerProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME).withGetter([this](){ return this->DiscoverableTimeout(); }).withSetter([this](const uint32_t& value){ this->DiscoverableTimeout(value); });
object_.registerProperty("Pairable").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Pairable(); }).withSetter([this](const bool& value){ this->Pairable(value); });
object_.registerProperty("PairableTimeout").onInterface(INTERFACE_NAME).withGetter([this](){ return this->PairableTimeout(); }).withSetter([this](const uint32_t& value){ this->PairableTimeout(value); });
object_.registerProperty("Discovering").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Discovering(); });
object_.registerProperty("UUIDs").onInterface(INTERFACE_NAME).withGetter([this](){ return this->UUIDs(); });
object_.registerProperty("Modalias").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Modalias(); });
object_.registerProperty("Roles").onInterface(INTERFACE_NAME).withGetter([this](){ return this->Roles(); });
}
~Adapter1_adaptor() = default;
private:
virtual void StartDiscovery() = 0;
virtual void SetDiscoveryFilter(const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void StopDiscovery() = 0;
virtual void RemoveDevice(const sdbus::ObjectPath& device) = 0;
virtual std::vector<std::string> GetDiscoveryFilters() = 0;
private:
virtual std::string Address() = 0;
virtual std::string AddressType() = 0;
virtual std::string Name() = 0;
virtual std::string Alias() = 0;
virtual void Alias(const std::string& value) = 0;
virtual uint32_t Class() = 0;
virtual bool Powered() = 0;
virtual void Powered(const bool& value) = 0;
virtual bool Discoverable() = 0;
virtual void Discoverable(const bool& value) = 0;
virtual uint32_t DiscoverableTimeout() = 0;
virtual void DiscoverableTimeout(const uint32_t& value) = 0;
virtual bool Pairable() = 0;
virtual void Pairable(const bool& value) = 0;
virtual uint32_t PairableTimeout() = 0;
virtual void PairableTimeout(const uint32_t& value) = 0;
virtual bool Discovering() = 0;
virtual std::vector<std::string> UUIDs() = 0;
virtual std::string Modalias() = 0;
virtual std::vector<std::string> Roles() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Properties_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Properties";
protected:
Properties_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Get").onInterface(INTERFACE_NAME).withInputParamNames("interface", "name").withOutputParamNames("value").implementedAs([this](const std::string& interface, const std::string& name){ return this->Get(interface, name); });
object_.registerMethod("Set").onInterface(INTERFACE_NAME).withInputParamNames("interface", "name", "value").implementedAs([this](const std::string& interface, const std::string& name, const sdbus::Variant& value){ return this->Set(interface, name, value); });
object_.registerMethod("GetAll").onInterface(INTERFACE_NAME).withInputParamNames("interface").withOutputParamNames("properties").implementedAs([this](const std::string& interface){ return this->GetAll(interface); });
object_.registerSignal("PropertiesChanged").onInterface(INTERFACE_NAME).withParameters<std::string, std::map<std::string, sdbus::Variant>, std::vector<std::string>>("interface", "changed_properties", "invalidated_properties");
}
~Properties_adaptor() = default;
public:
void emitPropertiesChanged(const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties)
{
object_.emitSignal("PropertiesChanged").onInterface(INTERFACE_NAME).withArguments(interface, changed_properties, invalidated_properties);
}
private:
virtual sdbus::Variant Get(const std::string& interface, const std::string& name) = 0;
virtual void Set(const std::string& interface, const std::string& name, const sdbus::Variant& value) = 0;
virtual std::map<std::string, sdbus::Variant> GetAll(const std::string& interface) = 0;
private:
sdbus::IObject& object_;
};
}}} // namespaces
namespace org {
namespace bluez {
class GattManager1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattManager1";
protected:
GattManager1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application", "options").implementedAs([this](const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterApplication(application, options); });
object_.registerMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application").implementedAs([this](const sdbus::ObjectPath& application){ return this->UnregisterApplication(application); });
}
~GattManager1_adaptor() = default;
private:
virtual void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterApplication(const sdbus::ObjectPath& application) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisingManager1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisingManager1";
protected:
LEAdvertisingManager1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterAdvertisement").onInterface(INTERFACE_NAME).withInputParamNames("advertisement", "options").implementedAs([this](const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterAdvertisement(advertisement, options); });
object_.registerMethod("UnregisterAdvertisement").onInterface(INTERFACE_NAME).withInputParamNames("service").implementedAs([this](const sdbus::ObjectPath& service){ return this->UnregisterAdvertisement(service); });
object_.registerProperty("ActiveInstances").onInterface(INTERFACE_NAME).withGetter([this](){ return this->ActiveInstances(); });
object_.registerProperty("SupportedInstances").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedInstances(); });
object_.registerProperty("SupportedIncludes").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedIncludes(); });
object_.registerProperty("SupportedSecondaryChannels").onInterface(INTERFACE_NAME).withGetter([this](){ return this->SupportedSecondaryChannels(); });
}
~LEAdvertisingManager1_adaptor() = default;
private:
virtual void RegisterAdvertisement(const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterAdvertisement(const sdbus::ObjectPath& service) = 0;
private:
virtual uint8_t ActiveInstances() = 0;
virtual uint8_t SupportedInstances() = 0;
virtual std::vector<std::string> SupportedIncludes() = 0;
virtual std::vector<std::string> SupportedSecondaryChannels() = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class Media1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Media1";
protected:
Media1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("RegisterEndpoint").onInterface(INTERFACE_NAME).withInputParamNames("endpoint", "properties").implementedAs([this](const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties){ return this->RegisterEndpoint(endpoint, properties); });
object_.registerMethod("UnregisterEndpoint").onInterface(INTERFACE_NAME).withInputParamNames("endpoint").implementedAs([this](const sdbus::ObjectPath& endpoint){ return this->UnregisterEndpoint(endpoint); });
object_.registerMethod("RegisterPlayer").onInterface(INTERFACE_NAME).withInputParamNames("player", "properties").implementedAs([this](const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties){ return this->RegisterPlayer(player, properties); });
object_.registerMethod("UnregisterPlayer").onInterface(INTERFACE_NAME).withInputParamNames("player").implementedAs([this](const sdbus::ObjectPath& player){ return this->UnregisterPlayer(player); });
object_.registerMethod("RegisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application", "options").implementedAs([this](const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options){ return this->RegisterApplication(application, options); });
object_.registerMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withInputParamNames("application").implementedAs([this](const sdbus::ObjectPath& application){ return this->UnregisterApplication(application); });
}
~Media1_adaptor() = default;
private:
virtual void RegisterEndpoint(const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void UnregisterEndpoint(const sdbus::ObjectPath& endpoint) = 0;
virtual void RegisterPlayer(const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties) = 0;
virtual void UnregisterPlayer(const sdbus::ObjectPath& player) = 0;
virtual void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options) = 0;
virtual void UnregisterApplication(const sdbus::ObjectPath& application) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
namespace org {
namespace bluez {
class NetworkServer1_adaptor
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.NetworkServer1";
protected:
NetworkServer1_adaptor(sdbus::IObject& object)
: object_(object)
{
object_.registerMethod("Register").onInterface(INTERFACE_NAME).withInputParamNames("uuid", "bridge").implementedAs([this](const std::string& uuid, const std::string& bridge){ return this->Register(uuid, bridge); });
object_.registerMethod("Unregister").onInterface(INTERFACE_NAME).withInputParamNames("uuid").implementedAs([this](const std::string& uuid){ return this->Unregister(uuid); });
}
~NetworkServer1_adaptor() = default;
private:
virtual void Register(const std::string& uuid, const std::string& bridge) = 0;
virtual void Unregister(const std::string& uuid) = 0;
private:
sdbus::IObject& object_;
};
}} // namespaces
#endif
+631
View File
@@ -0,0 +1,631 @@
/*
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
*/
#ifndef __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_proxy_h__proxy__H__
#define __sdbuscpp___home_rerdavies_src_pipedal_src_dbus_bluez_proxy_h__proxy__H__
#include <sdbus-c++/sdbus-c++.h>
#include <string>
#include <tuple>
namespace org {
namespace bluez {
class GattService1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattService1";
protected:
GattService1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattService1_proxy() = default;
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
bool Primary()
{
return proxy_.getProperty("Primary").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Characteristics()
{
return proxy_.getProperty("Characteristics").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattCharacteristic1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattCharacteristic1";
protected:
GattCharacteristic1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattCharacteristic1_proxy() = default;
public:
void WriteValue(const std::vector<uint8_t>& value)
{
proxy_.callMethod("WriteValue").onInterface(INTERFACE_NAME).withArguments(value);
}
void StartNotify()
{
proxy_.callMethod("StartNotify").onInterface(INTERFACE_NAME);
}
void StopNotify()
{
proxy_.callMethod("StopNotify").onInterface(INTERFACE_NAME);
}
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath Service()
{
return proxy_.getProperty("Service").onInterface(INTERFACE_NAME);
}
std::vector<uint8_t> Value()
{
return proxy_.getProperty("Value").onInterface(INTERFACE_NAME);
}
bool Notifying()
{
return proxy_.getProperty("Notifying").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Flags()
{
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
}
std::vector<sdbus::ObjectPath> Descriptors()
{
return proxy_.getProperty("Descriptors").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class GattDescriptor1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattDescriptor1";
protected:
GattDescriptor1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattDescriptor1_proxy() = default;
public:
std::vector<uint8_t> ReadValue()
{
std::vector<uint8_t> result;
proxy_.callMethod("ReadValue").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
public:
std::string UUID()
{
return proxy_.getProperty("UUID").onInterface(INTERFACE_NAME);
}
sdbus::ObjectPath Characteristic()
{
return proxy_.getProperty("Characteristic").onInterface(INTERFACE_NAME);
}
std::vector<uint8_t> Value()
{
return proxy_.getProperty("Value").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Flags()
{
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisement1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisement1";
protected:
LEAdvertisement1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~LEAdvertisement1_proxy() = default;
public:
void Release()
{
proxy_.callMethod("Release").onInterface(INTERFACE_NAME).dontExpectReply();
}
public:
std::string Type()
{
return proxy_.getProperty("Type").onInterface(INTERFACE_NAME);
}
std::vector<std::string> ServiceUUIDs()
{
return proxy_.getProperty("ServiceUUIDs").onInterface(INTERFACE_NAME);
}
std::map<std::string, sdbus::Variant> ManufacturerData()
{
return proxy_.getProperty("ManufacturerData").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SolicitUUIDs()
{
return proxy_.getProperty("SolicitUUIDs").onInterface(INTERFACE_NAME);
}
std::map<std::string, sdbus::Variant> ServiceData()
{
return proxy_.getProperty("ServiceData").onInterface(INTERFACE_NAME);
}
bool IncludeTxPower()
{
return proxy_.getProperty("IncludeTxPower").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Introspectable_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Introspectable";
protected:
Introspectable_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Introspectable_proxy() = default;
public:
std::string Introspect()
{
std::string result;
proxy_.callMethod("Introspect").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
namespace org {
namespace bluez {
class Adapter1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Adapter1";
protected:
Adapter1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Adapter1_proxy() = default;
public:
void StartDiscovery()
{
proxy_.callMethod("StartDiscovery").onInterface(INTERFACE_NAME);
}
void SetDiscoveryFilter(const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("SetDiscoveryFilter").onInterface(INTERFACE_NAME).withArguments(properties);
}
void StopDiscovery()
{
proxy_.callMethod("StopDiscovery").onInterface(INTERFACE_NAME);
}
void RemoveDevice(const sdbus::ObjectPath& device)
{
proxy_.callMethod("RemoveDevice").onInterface(INTERFACE_NAME).withArguments(device);
}
std::vector<std::string> GetDiscoveryFilters()
{
std::vector<std::string> result;
proxy_.callMethod("GetDiscoveryFilters").onInterface(INTERFACE_NAME).storeResultsTo(result);
return result;
}
public:
std::string Address()
{
return proxy_.getProperty("Address").onInterface(INTERFACE_NAME);
}
std::string AddressType()
{
return proxy_.getProperty("AddressType").onInterface(INTERFACE_NAME);
}
std::string Name()
{
return proxy_.getProperty("Name").onInterface(INTERFACE_NAME);
}
std::string Alias()
{
return proxy_.getProperty("Alias").onInterface(INTERFACE_NAME);
}
void Alias(const std::string& value)
{
proxy_.setProperty("Alias").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t Class()
{
return proxy_.getProperty("Class").onInterface(INTERFACE_NAME);
}
bool Powered()
{
return proxy_.getProperty("Powered").onInterface(INTERFACE_NAME);
}
void Powered(const bool& value)
{
proxy_.setProperty("Powered").onInterface(INTERFACE_NAME).toValue(value);
}
bool Discoverable()
{
return proxy_.getProperty("Discoverable").onInterface(INTERFACE_NAME);
}
void Discoverable(const bool& value)
{
proxy_.setProperty("Discoverable").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t DiscoverableTimeout()
{
return proxy_.getProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME);
}
void DiscoverableTimeout(const uint32_t& value)
{
proxy_.setProperty("DiscoverableTimeout").onInterface(INTERFACE_NAME).toValue(value);
}
bool Pairable()
{
return proxy_.getProperty("Pairable").onInterface(INTERFACE_NAME);
}
void Pairable(const bool& value)
{
proxy_.setProperty("Pairable").onInterface(INTERFACE_NAME).toValue(value);
}
uint32_t PairableTimeout()
{
return proxy_.getProperty("PairableTimeout").onInterface(INTERFACE_NAME);
}
void PairableTimeout(const uint32_t& value)
{
proxy_.setProperty("PairableTimeout").onInterface(INTERFACE_NAME).toValue(value);
}
bool Discovering()
{
return proxy_.getProperty("Discovering").onInterface(INTERFACE_NAME);
}
std::vector<std::string> UUIDs()
{
return proxy_.getProperty("UUIDs").onInterface(INTERFACE_NAME);
}
std::string Modalias()
{
return proxy_.getProperty("Modalias").onInterface(INTERFACE_NAME);
}
std::vector<std::string> Roles()
{
return proxy_.getProperty("Roles").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace freedesktop {
namespace DBus {
class Properties_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.freedesktop.DBus.Properties";
protected:
Properties_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
proxy_.uponSignal("PropertiesChanged").onInterface(INTERFACE_NAME).call([this](const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties){ this->onPropertiesChanged(interface, changed_properties, invalidated_properties); });
}
~Properties_proxy() = default;
virtual void onPropertiesChanged(const std::string& interface, const std::map<std::string, sdbus::Variant>& changed_properties, const std::vector<std::string>& invalidated_properties) = 0;
public:
sdbus::Variant Get(const std::string& interface, const std::string& name)
{
sdbus::Variant result;
proxy_.callMethod("Get").onInterface(INTERFACE_NAME).withArguments(interface, name).storeResultsTo(result);
return result;
}
void Set(const std::string& interface, const std::string& name, const sdbus::Variant& value)
{
proxy_.callMethod("Set").onInterface(INTERFACE_NAME).withArguments(interface, name, value);
}
std::map<std::string, sdbus::Variant> GetAll(const std::string& interface)
{
std::map<std::string, sdbus::Variant> result;
proxy_.callMethod("GetAll").onInterface(INTERFACE_NAME).withArguments(interface).storeResultsTo(result);
return result;
}
private:
sdbus::IProxy& proxy_;
};
}}} // namespaces
namespace org {
namespace bluez {
class GattManager1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.GattManager1";
protected:
GattManager1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~GattManager1_proxy() = default;
public:
void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options);
}
void UnregisterApplication(const sdbus::ObjectPath& application)
{
proxy_.callMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class LEAdvertisingManager1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.LEAdvertisingManager1";
protected:
LEAdvertisingManager1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~LEAdvertisingManager1_proxy() = default;
public:
void RegisterAdvertisement(const sdbus::ObjectPath& advertisement, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterAdvertisement").onInterface(INTERFACE_NAME).withArguments(advertisement, options);
}
void UnregisterAdvertisement(const sdbus::ObjectPath& service)
{
proxy_.callMethod("UnregisterAdvertisement").onInterface(INTERFACE_NAME).withArguments(service);
}
public:
uint8_t ActiveInstances()
{
return proxy_.getProperty("ActiveInstances").onInterface(INTERFACE_NAME);
}
uint8_t SupportedInstances()
{
return proxy_.getProperty("SupportedInstances").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SupportedIncludes()
{
return proxy_.getProperty("SupportedIncludes").onInterface(INTERFACE_NAME);
}
std::vector<std::string> SupportedSecondaryChannels()
{
return proxy_.getProperty("SupportedSecondaryChannels").onInterface(INTERFACE_NAME);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class Media1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.Media1";
protected:
Media1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~Media1_proxy() = default;
public:
void RegisterEndpoint(const sdbus::ObjectPath& endpoint, const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("RegisterEndpoint").onInterface(INTERFACE_NAME).withArguments(endpoint, properties);
}
void UnregisterEndpoint(const sdbus::ObjectPath& endpoint)
{
proxy_.callMethod("UnregisterEndpoint").onInterface(INTERFACE_NAME).withArguments(endpoint);
}
void RegisterPlayer(const sdbus::ObjectPath& player, const std::map<std::string, sdbus::Variant>& properties)
{
proxy_.callMethod("RegisterPlayer").onInterface(INTERFACE_NAME).withArguments(player, properties);
}
void UnregisterPlayer(const sdbus::ObjectPath& player)
{
proxy_.callMethod("UnregisterPlayer").onInterface(INTERFACE_NAME).withArguments(player);
}
void RegisterApplication(const sdbus::ObjectPath& application, const std::map<std::string, sdbus::Variant>& options)
{
proxy_.callMethod("RegisterApplication").onInterface(INTERFACE_NAME).withArguments(application, options);
}
void UnregisterApplication(const sdbus::ObjectPath& application)
{
proxy_.callMethod("UnregisterApplication").onInterface(INTERFACE_NAME).withArguments(application);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
namespace org {
namespace bluez {
class NetworkServer1_proxy
{
public:
static constexpr const char* INTERFACE_NAME = "org.bluez.NetworkServer1";
protected:
NetworkServer1_proxy(sdbus::IProxy& proxy)
: proxy_(proxy)
{
}
~NetworkServer1_proxy() = default;
public:
void Register(const std::string& uuid, const std::string& bridge)
{
proxy_.callMethod("Register").onInterface(INTERFACE_NAME).withArguments(uuid, bridge);
}
void Unregister(const std::string& uuid)
{
proxy_.callMethod("Unregister").onInterface(INTERFACE_NAME).withArguments(uuid);
}
private:
sdbus::IProxy& proxy_;
};
}} // namespaces
#endif
+58
View File
@@ -0,0 +1,58 @@
#include "bluez_adaptor.h"
#include "bluez.h"
#include "catch.hpp"
#define TEST_UUID "6b49786f-271d-415d-8e2c-bd5ef8aa6f47"
using TestAdvertisementInterfaces = sdbus::AdaptorInterfaces<org::bluez::LEAdvertisement1_adaptor>;
class TestAdvertisement: public TestAdvertisementInterfaces
{
private:
std::vector<std::string> serviceUuids;
public:
TestAdvertisement(sdbus::IConnection& connection, std::string objectPath)
: TestAdvertisementInterfaces(connection,std::move(objectPath))
{
serviceUuids.push_back(TEST_UUID);
}
private:
virtual void Release() { delete this; }
private:
virtual std::string Type() { return "peripheral"; }
virtual std::vector<std::string> ServiceUUIDs() { return serviceUuids; }
virtual std::map<std::string, sdbus::Variant> ManufacturerData() {
return std::map<std::string, sdbus::Variant>();
};
virtual std::vector<std::string> SolicitUUIDs() {
return std::vector<std::string>();
}
virtual std::map<std::string, sdbus::Variant> ServiceData()
{
return std::map<std::string, sdbus::Variant>();
}
virtual bool IncludeTxPower() {
return false;
}
};
void RunService()
{
const char* SERVICE_NAME="com.twoplay.pipedal.onboarding";
const char* SERVICE_PATH="/com/twoplay/pipedal/onboarding";
auto connector = sdbus::createSystemBusConnection(SERVICE_NAME);
TestAdvertisement testAdvertisement(*connector,SERVICE_PATH);
}
TEST_CASE( "Bluetooth service", "[bluetooth_service]" ) {
org::bluez::BleDeviceProxy device("org.bluez","/org/bluez/hci0");
auto includes = device.SupportedIncludes();
}
+31
View File
@@ -0,0 +1,31 @@
// Copyright (c) 2021 Robin Davies
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pch.h"
#include "catch.hpp"
#include <Uri.hpp>
#include <string>
using namespace piddle;
TEST_CASE( "lv2 host leak", "[uri]" ) {
}