×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Request for #defines for various property names

  • Posts: 100
  • Thank you received: 10
INDI code is filled with code like:
INDI::PropertyNumber ccdTemperature = camera->getProperty("CCD_TEMPERATURE");

where literal string are used. This seems very error prone to me. If you mistype a property name, you will often have subtle, hard to find, errors in the code.

I was working with INDIGO before coming to INDI. They have #defines for all common property names.
//----------------------------------------------------------------------
/** CONNECTION property name.
 */
#define CONNECTION_PROPERTY_NAME							"CONNECTION"
 
/** CONNECTION.CONNECTED property item name.
 */
#define CONNECTION_CONNECTED_ITEM_NAME				"CONNECTED"
 
/** CONNECTION.DISCONNECTED property item name.
 */
#define CONNECTION_DISCONNECTED_ITEM_NAME			"DISCONNECTED"
 
//----------------------------------------------------------------------
/** INFO property name.
 */
#define INFO_PROPERTY_NAME										"INFO"
 
/** INFO.DEVICE_NAME property item name.
 */
#define INFO_DEVICE_NAME_ITEM_NAME						"DEVICE_NAME"
 
/** INFO.DEVICE_DRIVER property item name.
 */
#define INFO_DEVICE_DRIVER_ITEM_NAME					"DEVICE_DRIVER"
 

This seems to me to be a good practice and would recommend INDI adopt something like it in the future.
1 year 4 months ago #89044

Please Log in or Create an account to join the conversation.

Time to create page: 0.178 seconds