LCOV - code coverage report
Current view: top level - src/libvalent/device - valent-device-plugin.h (source / functions) Coverage Total Hit
Test: Code Coverage Lines: 100.0 % 1 1
Test Date: 2024-05-12 19:03:18 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 50.0 % 6 3

             Branch data     Line data    Source code
       1                 :             : // SPDX-License-Identifier: GPL-3.0-or-later
       2                 :             : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
       3                 :             : 
       4                 :             : #pragma once
       5                 :             : 
       6                 :             : #if !defined (VALENT_INSIDE) && !defined (VALENT_COMPILATION)
       7                 :             : # error "Only <valent.h> can be included directly."
       8                 :             : #endif
       9                 :             : 
      10                 :             : #include <json-glib/json-glib.h>
      11                 :             : 
      12                 :             : #include "../core/valent-extension.h"
      13                 :             : #include "valent-device.h"
      14                 :             : 
      15                 :             : G_BEGIN_DECLS
      16                 :             : 
      17                 :             : #define VALENT_TYPE_DEVICE_PLUGIN (valent_device_plugin_get_type ())
      18                 :             : 
      19                 :             : VALENT_AVAILABLE_IN_1_0
      20   [ +  -  +  -  :        2568 : G_DECLARE_DERIVABLE_TYPE (ValentDevicePlugin, valent_device_plugin, VALENT, DEVICE_PLUGIN, ValentObject)
                   +  - ]
      21                 :             : 
      22                 :             : struct _ValentDevicePluginClass
      23                 :             : {
      24                 :             :   ValentExtensionClass   parent_class;
      25                 :             : 
      26                 :             :   /* virtual functions */
      27                 :             :   void                   (*handle_packet) (ValentDevicePlugin *plugin,
      28                 :             :                                            const char         *type,
      29                 :             :                                            JsonNode           *packet);
      30                 :             :   void                   (*update_state)  (ValentDevicePlugin *plugin,
      31                 :             :                                            ValentDeviceState   state);
      32                 :             : 
      33                 :             :   /*< private >*/
      34                 :             :   gpointer            padding[8];
      35                 :             : };
      36                 :             : 
      37                 :             : VALENT_AVAILABLE_IN_1_0
      38                 :             : void   valent_device_plugin_handle_packet     (ValentDevicePlugin *plugin,
      39                 :             :                                                const char         *type,
      40                 :             :                                                JsonNode           *packet);
      41                 :             : VALENT_AVAILABLE_IN_1_0
      42                 :             : void   valent_device_plugin_queue_packet      (ValentDevicePlugin *plugin,
      43                 :             :                                                JsonNode           *packet);
      44                 :             : VALENT_AVAILABLE_IN_1_0
      45                 :             : void   valent_device_plugin_update_state      (ValentDevicePlugin *plugin,
      46                 :             :                                                ValentDeviceState   state);
      47                 :             : 
      48                 :             : /* TODO: move to extension? */
      49                 :             : VALENT_AVAILABLE_IN_1_0
      50                 :             : void   valent_device_plugin_show_notification (ValentDevicePlugin *plugin,
      51                 :             :                                                const char         *id,
      52                 :             :                                                GNotification      *notification);
      53                 :             : VALENT_AVAILABLE_IN_1_0
      54                 :             : void   valent_device_plugin_hide_notification (ValentDevicePlugin *plugin,
      55                 :             :                                                const char         *id);
      56                 :             : 
      57                 :             : /* TODO: GMenuModel XML */
      58                 :             : VALENT_AVAILABLE_IN_1_0
      59                 :             : void   valent_device_plugin_set_menu_action   (ValentDevicePlugin *plugin,
      60                 :             :                                                const char         *action,
      61                 :             :                                                const char         *label,
      62                 :             :                                                const char         *icon_name);
      63                 :             : VALENT_AVAILABLE_IN_1_0
      64                 :             : void   valent_device_plugin_set_menu_item     (ValentDevicePlugin *plugin,
      65                 :             :                                                const char         *action,
      66                 :             :                                                GMenuItem          *item);
      67                 :             : 
      68                 :             : /* Miscellaneous Helpers */
      69                 :             : VALENT_AVAILABLE_IN_1_0
      70                 :             : void   valent_notification_set_device_action  (GNotification      *notification,
      71                 :             :                                                ValentDevice       *device,
      72                 :             :                                                const char         *action,
      73                 :             :                                                GVariant           *target);
      74                 :             : VALENT_AVAILABLE_IN_1_0
      75                 :             : void   valent_notification_add_device_button  (GNotification      *notification,
      76                 :             :                                                ValentDevice       *device,
      77                 :             :                                                const char         *label,
      78                 :             :                                                const char         *action,
      79                 :             :                                                GVariant           *target);
      80                 :             : 
      81                 :             : G_END_DECLS
      82                 :             : 
        

Generated by: LCOV version 2.0-1