Re: Separate icon area: interface for drivers?

Wolfgang Hauck <[email protected]>
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <[email protected]>
Am 23.10.2011 02:21, schrieb Stefan Herdler:
> Hi,
>
> Am 22.10.2011 09:01, Markus Dolze wrote:
>>
>>> There so many different displays out there, why don't we let the
>>> drivers define the names of Icons?
>>> For the common icons we may suggest some recommend icon-names like
>>> HDD0, HDD1, CD0...
>>> This open system makes it easy to add new Icons and it is expandable
>>> for new currently unknown features.
>> I'd like to avoid this because it will cause copying code from driver to
>> driver like it is done with the current icon function. If LCDd announces
>> the available pictograms to the client there is no need for a new
>> protocol version if drivers writers add new pictograms to the language
>> in the central place.
>>
> The Driver would only contain an array like this:
> (Code for illustration only!)
>
> # define bar  1
> static const icon_type icons[] = {{"name" ,type},
>                                                {"volume" ,bar},
>                                                         .....
>             {"0",0 }};  // < Do we really need that "0 0"?
>
>
> The server has to get a pointer to this array, that's it.
> I think that is the clearest and best understandable way defining the 
> Icons of a display.
> Just type the icon names and types in that array and they are defined.
>
> Well, there a few icon names would show up in several drivers, so what.
> The icons have to defined anyway and this will always result in an 
> array or something similar in driver.
> The other advantage of my approach is that the server doesn't contain 
> a huge (and growing!) list of icon-definitions.
> This is inefficient especially because most of the defined icons 
> aren't supported by the actually used display.
>
>
> The driver-function (one for all icon-types) which is called by the 
> server to put the icons on the screen can be kept very simple and slim:
>
> function set_Icon( unsigned char Icon_Number, int Icon_Value) {
> // "Icon_Number" : position in the array
> // "Icon_Value" : value to set
>
> switch(Icon_Number)
> ....
> }
>>> The client should be able to get the list of the Icons the Display.
>>> The List could look somehow like this: "iconname,icontype HDD1,icon
>>> Volume,bar Antenna,bar Mail,icon ...."
>>> According to the "icontype" the client knows what functionality each
>>> Icon provides and could choose which one to use.
>> I asked myself if it is really necessary to tell the client the
>> pictogram type at all. If the client does use a pictogram it already
>> knows what to do with it (as it must have been programmed that way). I
>> doubt that clients will use unknown pictograms even if they know 
>> their type.
>>
> It is not absolutely necessary for operation.
> But it will help to make the client smarter selecting icons, 
> especially if it is a client with user interaction.
>
> For example if the client needs a bar-type icon to show the 
> wlan-strength, but the display doesn't have icons named "antenna" nor 
> "wlan". If it knows which icons are bar-type-icons it could choose an 
> other unused bar-type-icon.
> If the client has a configuration-menu (like the VDR-LCDproc-client) 
> it could suppress all non fitting icons for a function which is much 
> more convenient for the user.
>>
>> The use of negative values is something we should think of. I'm not sure
>> if it should be used for highlighting. But it may be a valid option on
>> bars to indicate "grow in the opposite direction" for bars which can
>> grow to left and right.
>>
> I don't know any display with a bar which could grow either to the 
> left or right side.
> I would treat that rare case as a normal bar.
> 50% is the middle position, that's straight forward I think.
>
> If the can grow to both sides at one time with different lengths is it 
> not one bar.
> There two independent bars and we should treat them like this.
>> Agreed. I think, altough we talked about pictogram 'groups' there was no
>> talk that only one may be active at the same time, did we?
>>
> At this point I just wanted to explain my needs as driver programmer.
>
> Regards
> Stefan
> _______________________________________________
> LCDproc mailing list
> [email protected]
> http://lists.omnipotent.net/mailman/listinfo/lcdproc
>

Hi!

(I suggest to allow HTML to read this e-mail.)

So there is common sense on a driver function like (but see my addition 
at end of mail):

      * int set_pictogram(PictId id, signed int value)

          o id identifies the pictogram. PictId should be unsigned int.

          o value sets the pictogram's value
              + Range is from 0 to 1000.
              + Boolean pictograms are switched off with 0 (0..499) and
                switched on with 1000 (500..1000).
              + Parametric pictograms visualise the value in some way,
                which is not specified further.
              + A negative value highlights the pictogram. Highlighting
                is not specified further, it can be implemented as
                frame, brightness, colour, blinking, etc.


The remaining question is: _How to map client's wishes to pictogram 
identifiers? _


First summarise two alternative approaches:

 1. Maintain an enumeration of pictogram with identifiers "HDD", "CD",
    "DVD", ... All drivers have to use these identifiers; however,
    drivers need not implement all of them.
 2. Stefan's suggestion pushed to a little other direction. Move the
    list of pictograms out of the driver, and store the information in a
    configuration file individual to each driver. Thus, the information
    is available to client and client's user. The file contains a table
    (/class/ is optional, explanation follows):
    /line/
    	/par
    / 	/class/
    	/description
    /
    1
    	bool
    	HDD
    	(whatever you like, for user information; here for HDD)
    2
    	bool
    	CD
    	(whatever you like, for user information; here for CD)
    3
    	bool
    	DVD
    	(whatever you like, for user information; here for DVD)
    4
    	level
    	BAR
    	(whatever you like, for user information; here for volume shown as
    small staircase)
    5
    	level
    	BAR 	(whatever you like, for user information; here for WLAN signal
    strength shown as small staircase)


What does a client want to do? It wants to display its concern. E.g. it 
knows, aha, there is CD in the tray, I would like to show this 
information to my user. Applied to the two approaches, this means:

 1. The client looks if there is CD pictogram, which is by definition
    has the id "CD". The client switches on the pictogram with this id.
    The id is passed to set_pictogram. No mapping is required. But the
    example with several bar pictograms, where the client may choose
    one, shows that an instance should be specified, which leads to:
    int set_pictogram(PictClass class, unsigned char inst, signed int value)
      * class identifies the pictogram , e.g. "HDD", "CD", "DVD" or "BAR".
      * inst selects the instance of the pictogram type. Example: There
        are two staircase bars, so there are instances "BAR1" and "BAR2"
        of class "BAR".
      * value sets the pictogram's value as above.
 2. The handling differs, depending if the class column is present or not.
      * Class information is available: The client looks if there is CD
        pictogram. The file table tells "yes, there is such a class",
        and the found class (plus instance, if applicable) is passed to
        set_pictogram.
      * No class information available: Then you only have the
        description, which varies from display device to display device.
        Consequently, there has to be some user interaction. The client
        asks its user which line to use to display the concern "CD
        present" (configuration dialogue), or the client evaluates its
        user generated configuration file where the concern "CD present"
        is mapped to line 2 of the pictogram configuration file.

Rating of approaches (no claim for completeness...):

/
/ 	/1. approach
/ 	/2. approach
/
/Advantages
/ 	

  * No configuration by user required.
  * More applicatons might run out of the box.
  * There is a standard emulation pictogram set for non-pictogram-displays.

	

  * Very flexible.
  * No thinking about existing and upcoming pictogram classes.
  * Better modularity of drivers.
  * No global object to be maintained.

/Disadvantages
/ 	

  * Maintenance of pictogram class enumeration (see attached header file).
  * User defined pictograms have to be configured anyway by user.
  * Instance has to be specified.
  * Instance of pictogram class may have to be configured anyway by user.

	

  * Configuration by user is mandatory.
  * Configuration file required.
  * Clients have to implement configuration means.
  * Each application needs its own configuration.
  * Difficult to exchange configurations between applications or displays.


As you may have noticed, I did not mention efficiency here. In fact, 
both approaches are comparable in efficiency. E.g. for both approaches, 
arrays of supported pictograms are possible. And exporting an array just 
adds another interface function.


So the question above has changed: _Which approach is more likely to 
support a better launch into the open source community - especially 
regarding acceptance by both client/driver developers and client users?_

I have no clear answer to this question. On the one hand, implementers 
for clients and drivers are needed, and therefore have to be motivated. 
On the other hand, applications should be amenable to average Linux users.

Maybe you can give some more arguments to select an approach.


Regards,
Wolfgang

_______________________________________________
LCDproc mailing list
[email protected]
http://lists.omnipotent.net/mailman/listinfo/lcdproc
lcd_pictograms.h (text/plain, 8.6 KB)
/**
 * Pictogram classes, focus on multi-media.
 * PICT_<group>_<type>_<name>
 * <type> is one of
 * - "SW" (can be switched off or on)
 * - "LV" (some kind of level can be specified)
 */
enum
{
    /* Source or destination of media stream */

    PICT_INOUT_SW_HDD                   =  0x0000,
    PICT_INOUT_SW_FIREWIRE              =  0x0001,
    PICT_INOUT_SW_USB                   =  0x0002,
    PICT_INOUT_SW_CD                    =  0x0003,
    PICT_INOUT_SW_DVD                   =  0x0004,
    PICT_INOUT_SW_BLURAY                =  0x0005,
    PICT_INOUT_SW_TV                    =  0x0006,
    PICT_INOUT_SW_HDTV                  =  0x0007,
    PICT_INOUT_SW_RADIO                 =  0x0008,
    PICT_INOUT_SW_WEB                   =  0x0009,
    PICT_INOUT_RESERVED_1               =  0x000A,
    PICT_INOUT_RESERVED_2               =  0x000B,
    PICT_INOUT_RESERVED_3               =  0x000C,
    PICT_INOUT_RESERVED_4               =  0x000D,
    PICT_INOUT_RESERVED_5               =  0x000E,
    PICT_INOUT_RESERVED_6               =  0x000F,

    /* Navigation in media material */

    PICT_NAVIGATION_SW_PLAY             =  0x0010,
    PICT_NAVIGATION_SW_PAUSE            =  0x0011,
    PICT_NAVIGATION_SW_STOP             =  0x0011,
    PICT_NAVIGATION_SW_RECORD           =  0x0012,
    PICT_NAVIGATION_SW_FAST_FORWARD     =  0x0013,
    PICT_NAVIGATION_SW_REWIND           =  0x0014,
    PICT_NAVIGATION_SW_REPEAT           =  0x0015,
    PICT_NAVIGATION_SW_SHUFFLE          =  0x0016,
    PICT_NAVIGATION_SW_REPEAT           =  0x0017,
    PICT_NAVIGATION_RESERVED_2          =  0x0018,
    PICT_NAVIGATION_RESERVED_3          =  0x0019,
    PICT_NAVIGATION_RESERVED_4          =  0x001A,
    PICT_NAVIGATION_RESERVED_5          =  0x001B,
    PICT_NAVIGATION_RESERVED_6          =  0x001C,
    PICT_NAVIGATION_RESERVED_7          =  0x001D,
    PICT_NAVIGATION_RESERVED_8          =  0x001E,
    PICT_NAVIGATION_RESERVED_9          =  0x001F,

    /* Status information */

    PICT_STATUS_SW_POWER                =  0x0020,
    PICT_STATUS_SW_STANDBY              =  0x0021,
    PICT_STATUS_SW_REMOTE_CTRL          =  0x0022,
    PICT_STATUS_SW_TIME                 =  0x0023,
    PICT_STATUS_SW_TIMER                =  0x0024,
    PICT_STATUS_SW_ALARM                =  0x0025,
    PICT_STATUS_SW_TRAFFIC              =  0x0026,
    PICT_STATUS_LV_TRAFFIC              =  0x0027,
    PICT_STATUS_SW_WLAN                 =  0x0028,
    PICT_STATUS_LV_WLAN                 =  0x0029,
    PICT_STATUS_SW_MESSAGE              =  0x002A,
    PICT_STATUS_SW_EMAIL                =  0x002B,
    PICT_STATUS_SW_SYNC                 =  0x002C,
    PICT_STATUS_SW_BUSY                 =  0x002D,
    PICT_STATUS_RESERVED_1              =  0x002E,
    PICT_STATUS_RESERVED_2              =  0x002F,

    /* General level display */

    PICT_LEVEL_LV_BAR                   =  0x0030,
    PICT_LEVEL_LV_STAIRCASE             =  0x0031,
    PICT_LEVEL_LV_GAUGE                 =  0x0032,
    <to be continued>

    /* Various applications */

    PICT_APPLICATION_SW_MOVIE           =  0x0040,
    PICT_APPLICATION_SW_MUSIC           =  0x0041,
    PICT_APPLICATION_SW_PHOTO           =  0x0042,
    PICT_APPLICATION_SW_NEWS            =  0x0043,
    PICT_APPLICATION_SW_WEATHER         =  0x0044,
    PICT_APPLICATION_RESERVED_1         =  0x0045,
    PICT_APPLICATION_RESERVED_2         =  0x0047,
    PICT_APPLICATION_RESERVED_3         =  0x0048,
    PICT_APPLICATION_RESERVED_4         =  0x0049,
    PICT_APPLICATION_RESERVED_5         =  0x004A,
    PICT_APPLICATION_RESERVED_6         =  0x004B,
    PICT_APPLICATION_RESERVED_7         =  0x004C,
    PICT_APPLICATION_RESERVED_8         =  0x004D,
    PICT_APPLICATION_RESERVED_9         =  0x004E,
    PICT_APPLICATION_RESERVED_10        =  0x004F,

    /* Video settings */

    PICT_VIDEO_SW_RES_480I              =  0x0050
    PICT_VIDEO_SW_RES_480P              =  0x0051,
    PICT_VIDEO_SW_RES_576I              =  0x0052,
    PICT_VIDEO_SW_RES_576P              =  0x0053,
    PICT_VIDEO_SW_RES_720I              =  0x0054,
    PICT_VIDEO_SW_RES_720P              =  0x0055,
    PICT_VIDEO_SW_RES_1080I             =  0x0056,
    PICT_VIDEO_SW_RES_1080P             =  0x0057,
    PICT_VIDEO_SW_INTERLACED            =  0x0058,
    PICT_VIDEO_SW_PROGRESSIVE           =  0x0059,
    PICT_VIDEO_SW_25HZ                  =  0x005A,
    PICT_VIDEO_SW_50HZ                  =  0x005B,
    PICT_VIDEO_SW_30HZ                  =  0x005C,
    PICT_VIDEO_SW_60HZ                  =  0x005D,
    PICT_VIDEO_SW_WIDESCREEN            =  0x005E,
    PICT_VIDEO_RESERVED                 =  0x005F,

    /* Audio settings */

    PICT_AUDIO_SW_VOLUME                =  0x0060,
    PICT_AUDIO_LV_VOLUME                =  0x0061,
    PICT_AUDIO_SW_MUTE                  =  0x0062,
    PICT_AUDIO_SW_SPDIF                 =  0x0063,
    <to be continued>

    /* Speaker settings */

    PICT_SPEAKER_SW_LEFT                =  0x0070,
    PICT_SPEAKER_SW_CENTER              =  0x0071,
    PICT_SPEAKER_SW_RIGHT               =  0x0072,
    PICT_SPEAKER_SW_LFE                 =  0x0073,
    PICT_SPEAKER_SW_LEFT_SIDE           =  0x0074,
    PICT_SPEAKER_SW_RIGHT_SIDE          =  0x0075,
    PICT_SPEAKER_SW_LEFT_REAR           =  0x0076,
    PICT_SPEAKER_SW_RIGHT_REAR          =  0x0077,
    PICT_SPEAKER_SW_SURROUND_2_1        =  0x0078,
    PICT_SPEAKER_SW_SURROUND_5_1        =  0x0079,
    PICT_SPEAKER_SW_SURROUND_6_1        =  0x007A,
    PICT_SPEAKER_SW_SURROUND_7_1        =  0x007B,
    PICT_SPEAKER_RESERVED_1             =  0x007C,
    PICT_SPEAKER_RESERVED_2             =  0x007D,
    PICT_SPEAKER_RESERVED_3             =  0x007E,
    PICT_SPEAKER_RESERVED_4             =  0x007F,

    /* Audio/Video containers */

    PICT_CONTAINER_SW_3GP               =  0x0080,
    PICT_CONTAINER_SW_AIFF              =  0x0081,
    PICT_CONTAINER_SW_ASF               =  0x0082,
    PICT_CONTAINER_SW_AVI               =  0x0083,
    PICT_CONTAINER_SW_EVO               =  0x0084,
    PICT_CONTAINER_SW_FLV               =  0x0085,
    PICT_CONTAINER_SW_MPEG              =  0x0086,
    PICT_CONTAINER_SW_MATROSKA          =  0x0087,
    PICT_CONTAINER_SW_MPEGTS            =  0x0088,
    PICT_CONTAINER_SW_MPEGPS            =  0x0089
    PICT_CONTAINER_SW_MP4               =  0x008A,
    PICT_CONTAINER_SW_OGG               =  0x008B,
    PICT_CONTAINER_SW_QUICKTIME         =  0x008C,
    PICT_CONTAINER_SW_REALMEDIA         =  0x008D,
    PICT_CONTAINER_SW_VOB               =  0x008E,
    PICT_CONTAINER_SW_WAV               =  0x008F,

    /* Video codecs and alike */

    PICT_VIDEO_CODEC_SW_DIVX            =  0x0090,
    PICT_VIDEO_CODEC_SW_XVID            =  0x0091,
    PICT_VIDEO_CODEC_SW_WMV             =  0x0092,
    <to be continued>

    /* Video formats */

    PICT_VIDEO_FORMAT_?                 =  0x00A0,
    <to be continued>

    /* Audio codecs and alike */

    PICT_AUDIO_CODEC_?                  =  0x00B0,
    <to be continued>
    
    /* Video formats */

    PICT_AUDIO_FORMAT_?                 =  0x00C0,
    <to be continued>

    /* User defined switches */

    PICT_USER_SW_RESERVED_1             = 0x8000,
    PICT_USER_SW_RESERVED_2             = 0x8001,
    PICT_USER_SW_RESERVED_3             = 0x8002,
    PICT_USER_SW_RESERVED_4             = 0x8003,
    PICT_USER_SW_RESERVED_5             = 0x8004,
    PICT_USER_SW_RESERVED_6             = 0x8005,
    PICT_USER_SW_RESERVED_7             = 0x8006,
    PICT_USER_SW_RESERVED_8             = 0x8007,   
    PICT_USER_SW_RESERVED_9             = 0x8008,
    PICT_USER_SW_RESERVED_10            = 0x8009,
    PICT_USER_SW_RESERVED_11            = 0x800A,
    PICT_USER_SW_RESERVED_12            = 0x800B,
    PICT_USER_SW_RESERVED_13            = 0x800C,
    PICT_USER_SW_RESERVED_14            = 0x800D,
    PICT_USER_SW_RESERVED_15            = 0x800E,
    PICT_USER_SW_RESERVED_16            = 0x800F,

    /* User defined levels */

    PICT_USER_LV_RESERVED_1             = 0x8010,
    PICT_USER_LV_RESERVED_2             = 0x8011,
    PICT_USER_LV_RESERVED_3             = 0x8012,
    PICT_USER_LV_RESERVED_4             = 0x8013,
    PICT_USER_LV_RESERVED_5             = 0x8014,
    PICT_USER_LV_RESERVED_6             = 0x8015,
    PICT_USER_LV_RESERVED_7             = 0x8016,
    PICT_USER_LV_RESERVED_8             = 0x8017,   
    PICT_USER_LV_RESERVED_9             = 0x8018,
    PICT_USER_LV_RESERVED_10            = 0x8019,
    PICT_USER_LV_RESERVED_11            = 0x801A,
    PICT_USER_LV_RESERVED_12            = 0x801B,
    PICT_USER_LV_RESERVED_13            = 0x801C,
    PICT_USER_LV_RESERVED_14            = 0x801D,
    PICT_USER_LV_RESERVED_15            = 0x801E,
    PICT_USER_LV_RESERVED_16            = 0x801F

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.