Structures - mindaptiv/Saul GitHub Wiki

Structures

##Cylon.h

###struct cylonStruct cylonStruct acts as a container for holding user profile information, system settings, and hardware specifications, and should be compatible with Foster, as well as any other libraries as part of the Centurion project.

####Variables ####Time

  • uint32_t milliseconds
  • current milliseconds for local time
  • uint32_t seconds
  • current seconds for local time
  • uint32_t minutes
  • current minutes for local time
  • uint32_t hours
  • current hours for local time, represented in 24 hour clock format

####Date

  • uint32_t day
  • day of the week, supported values are:
    • 0 = Sunday
    • 1 = Monday
    • 2 = Tuesday
    • 3 = Wednesday
    • 4 = Thursday
    • 5 = Friday
    • 6 = Saturday
  • uint32_t date
  • today's date, 1-31
  • uint32_t month
  • _the current month, supported values are:
    • 1 = January
    • 2 = February
    • 3 = March
    • 4 = April
    • 5 = May
    • 6 = June
    • 7 = July
    • 8 = August
    • 9 = September
    • 10 = October
    • 11 = November
    • 12 = December
  • uint32_t year
  • the current year, valid responses are 1601 until the cows come home

####Time Zone

  • uint32_t dst
  • denotes if time is current in DST mode, supported values are:
    • 0 = standard time
    • 1 = daylight time
    • otherwise = invalid
  • int32 timeZone
  • time zone bias expressed in minutes +/- UTC
  • std::string timeZoneName
  • standard abbreviation for time zone (EST, MST, etc.)

####Processor

  • std:;string architecture
  • architecture of the processor (i.e. Itanium, etc.)
  • uint16_t processorLevel
  • placeholder for architecture-dependent processor level information provided by Windows, currently unused
  • uint32_t pageSize
  • page size utilized by processor, measured in bytes
  • uint32_t processorCount
  • number of processors detected on the current machine
  • uint32_t allocationGranularity
  • granularity for starting address where virtual memory can be allocated
  • uintptr_t minAppAddress
  • lowest address in memory that an application can access
  • uintptr_t maxAppAaddress
  • highest address in memory that an application can access
  • uint64_t hertz
  • minimum supported value for processor speed measured in hertz

####Memory

  • uint64_t memoryBytes
  • the total installed RAM in bytes
  • uint64_t threshold
  • the amount of RAM in bytes that signifies the device is running low on memory
  • uint64_t bytesAvails
  • the amount of RAM free in bytes
  • int lowMemory
  • a value of 1 denotes that the device is running low on memory, otherwise the value is set to 0
  • uint32_t osArchitecture
  • operating system bit-level architecture, current supported values are:
    • 32 = 32-bit OS
    • 64 = 64-bit OS

####Account Picture

  • uintptr_t pictureLocation
  • address value of pointer to a container for the presently logged-in user's account picture
  • std::string pictureType
  • gives the file extension of the picture variable, used for debugging purposes
  • std::string picturePath
  • the file system path where the picture is stored

####Device Information

  • uint32_t installedDeviceCount
  • total number of installed devices detected
  • uint32_t detectedDeviceCount
  • total number of currently detected devices
  • uint32_t portableStorageCount
  • total number of currently attached portable storage devices
  • uint32_t videoCount
  • total number of currently attached video capture devices
  • uint32_t micCount
  • total number of currently attached audio capture devices
  • uint32_t speakerCount
  • total number of currently attached audio rendering devices
  • uint32_t locationCount
  • total number of currently attached location aware devices
  • uint32_t scannerCount
  • total number of currently attached image scanning devices
  • std::list detectedDevices
  • doubly linked list filled with nodes of type deviceStruct, for holding all detected devices' metadata
  • std::list displayDevices
  • doubly linked list filled with nodes of type displayStruct, for holding all detected displays' metadata
  • std::list controllers
  • doubly linked list filled with nodes of type controllerStruct, for holding all detected controller's metadata
  • std::list storages
  • doubly linked list filled with nodes of type storageStruct
  • std::list sensors
  • doubly linked list filled with nodes of type sensorsStruct
  • std::list midiDevices
  • doubly linked list filled with nodes of type midiStruct
  • struct mouseStruct mice
  • holds pooled metadata for all detected mice in a singular container

####Error

  • int32 error
  • placeholder for returning errors

###struct deviceStruct deviceStruct acts as a container for holding specific information for a detected device in a singular location.

####Variables ####Type

  • uint32_t deviceType

  • denotes the type of device described in the deviceStruct. Additionally used for polymorphic structs for more specific deviceTypes that "inherit" from deviceStruct. Valid values include:

    • 0 = erroneous type
    • 1 = generic type
    • 2 = audio capture
    • 3 = audio render
    • 4 = storage
    • 5 = video capture
    • 6 = image scanner
    • 7 = location aware
    • 8 = display
    • 9 = mouse
    • 10 = keyboard
    • 11 = controller
    • 12 = touchscreen
    • 13 = touch pad
    • 14 = trackball
    • 15 = stylus
    • 16 = position
    • 17 = currently unused
    • 18 = rumble
    • 19 = sensor
    • 20 = bluetooth radio
  • uint32_t displayIndex

  • denotes the index of this deviceStruct's corresponding displayStruct IFF its type is equal to 8, otherwise the value is defaulted to zero

  • uint32_t controllerIndex

  • denotes the index of this deviceStruct's corresponding controllerStruct IFF its type is equal to 11, otherwise the value is defaulted to zero

  • uint32_t sensorsIndex

  • denotes the index of this struct's corresponding sensorStruct IFF its type is equal to 19, otherwise the value is defaulted to zero

  • uint32_t storageIndex

  • denotes the index of this struct's corresponding storageStruct IFF its type is equal to 17, otherwise the value is defaulted to zero

  • uint32_t midiIndex

  • denotes the index of this struct's corresponding midiStruct IFF its type is equal to 30, otherwise the value is defaulted to zero

  • uint32_t vendorID

  • denotes the vendor ID of the device, when available

####Location

  • uint32_t orientation
  • for cameras, denotes the orientation of the device IFF its type is equal to 5 (camera), otherwise defaults to 0. While not yet implemented, this will also extend to devices of type 8 (display)
  • uint32_t panelLocation
  • for built in devices, such as laptop webcams, this value denotes the location of the device on the computer, supported values are:
    • 0 = error/invalid/unknown
    • 1 = front
    • 2 = back
    • 3 = top
    • 4 = bottom
    • 5 = left
    • 6 = right
  • uint32_t inLid
  • true if device is located in the lid of the computer, false otherwise
  • uint32_t inDock
  • true if device is located in the dock of the computer, false otherwise

####Usability

  • uint32_t isEnabled
  • true if the device is presently enabled, false otherwise
  • uint32_t isDefault
  • true if the device is the default option for its device type, false otherwise

####Names

  • std::string wName
  • name of the device, a string of "0" denotes a device with no valid name found
  • std::string id_string
  • unique ID of the device, a string of "0" denotes a device with no valid ID found_
  • uint32_t id_int
  • unique ID of the device in integer format, when supported
  • uint32_t usb_bus
  • the usb bus number of the device, where applicable
  • uint32_t udev_deviceNumber
  • the udev device number for the device

###struct displayStruct displayStruct holds additional information for a display device not normally found in a deviceStruct, but contains a pointer to a deviceStruct so that its location may be used for the list of deviceStructs found in cylonStruct.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The displayStruct's parent deviceStruct container
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####Rotation

  • uint32_t rotationPreference
  • the preferred rotation of the current app, supported values are:
    • 0 = none
    • 1 = landscape
    • 2 = portrait
    • 4 = flipped landscape
    • 8 = flipped portrait
  • uint32_t currentRotation
  • the current rotation of the primary monitor, supported values are:
    • 0 = none
    • 1 = landscape
    • 2 = portrait
    • 4 = flipped landscape
    • 8 = flipped portrait
  • uint32_t nativeRotation
  • the native rotation of the primary monitor, supported values are:
    • 0 = none
    • 1 = landscape
    • 2 = portrait
    • 4 = flipped landscape
    • 8 = flipped portrait

####Resolution

  • float resolutionScale
  • the current scale of the resolution in reference to the size of the primary monitor, as decimal multiplier (100% = 1.0, etc.)
  • float logicalDPI
  • the logical dots per inch of the primary monitor
  • float rawDPIX
  • the raw dots per inch across the width of the primary monitor
  • float rawDPIY
  • the raw dots per inch across the height of the primary monitor
  • uint32_t horizontalResolution
  • the horizontal resolution of the display
  • uint32_t verticalResolution
  • the vertical resolution of the display
  • uint32_t upperLeftY
  • the upper left Y pixel value for the combined screen canvas of all displays
  • uint32_t upperLeftX
  • the upper left X pixel value for the combined screen canvas of all displays

####Other

  • float refreshRate
  • the rate at which the screen refreshes
  • void driverData*
  • a pointer to driver specific data on the display
  • unsigned char colorData*
  • a data stream for the color profile of the screen
  • unsigned int colorLength
  • the size of the colorData buffer

####3D

  • uint32_t isStereoscopicEnabled
  • true of stereoscopic 3D is enabled on the primary monitor, false otherwise

###struct controllerStruct controllerStruct acts as a container for holding specific information for a detected controller in a singular location.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The corresponding deviceStruct for this controllerStruct
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####Player

  • uint32_t userIndex
  • The player number of the controller, starting from 0 (typically 0-3 for a 4 player game, so player 1 in a given game would be userIndex 0)

####Buttons

  • uint32_t packetNumber
  • Used to track if changes to the controller have occurred between requests
  • uint16_t buttons
  • Bit mask based on Windows documentation that defines which buttons are currently being pressed
  • float leftTrigger
  • Value between 0 & 255 representing how far the left trigger is depressed
  • float rightTrigger
  • Value between 0 & 255 representing how far the right trigger is depressed
  • float thumbLeftX
  • Left thumbstick x-axis value between -32768 and 32767, a value of 0 is centered, negative values signify left, positive values signify right
  • float thumbRightX
  • Right thumbstick x-axis value between -32768 and 32767, a value of 0 is centered, negative values signify left, positive values signify right
  • float thumbLeftY
  • Left thumbstick y-axis value between 32768 and 32767, a value of 0 is centered, negative values signify down, positive values signify up
  • float thumbRightY
  • Right thumbstick y-axis value between 32768 and 32767, a value of 0 is centered, negative values signify down, positive values signify up

###struct storageStruct storageStruct stores data specific to certain devices that are used for storage capabilities.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The corresponding "parent" device for the storageStruct
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####Properties

  • std::string path
  • The path in the OS file system to the storage drive location.
  • uint64_t bytesAvails
  • The space free in the storage drive measured in bytes
  • uint64_t totalBytes
  • The total size in bytes of the storage drive
  • uint32_t isEmulated
  • If the storage drive is emulated, 0 for no/unknown, 1 for yes

###struct sensorStruct sensorStruct stores data specific to certain devices that are used as on-board or peripheral sensors for the given operating environment.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The corresponding "parent" device for the sensorStruct
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####Properties

  • uint32_t minDelay
  • The minimum delay allowed between two events, measured in microseconds. This value may also be 0 if the sensor only returns new data when actively observing a change in its readings.
  • uint32_t type
  • The specific type of sensor this object holds data for, based on the Android mapping found here.
  • uint32_t version
  • The release number of the given sensor.
  • std::string vendor
  • The name of the vendor for the given sensor.
  • std::string name
  • The name of the given sensor.
  • float power
  • The power drawn by the sensor, measured in mA
  • float resolution
  • The resolution the scanner uses for scans
  • uint32_t fifoMaxEventCount
  • The max number of events the sensor can have batched, a value of 0 indicates batch mode is not supported, this value is not guaranteed as other sensors may share the same batch space at run time
  • uint32_t fifoReservedEventCount
  • Guaranteed minimum number of FIFO events for the sensor that can be batch
  • std::string stringType
  • A string representation of the sensor's type
  • uint32_t maxDelay
  • _The delay between two sensor events measured in microseconds for the lowest frequency the given sensor cna operate with. Used only for continuous and on-change sensors, and invalid when less than 1.
  • uint32_t reportingMode
  • The reporting mode for the given sensor, based on the Android mapping found here
  • uint32_t isWakeUpSensor
  • Denotes if the given sensor is a wake up sensor, 1 for yes, 0 for no/unknown

###struct mididStruct midiStructs are native representations of data retrieved from the Android Midi class.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The corresponding "parent" device of this MIDI device
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####ID

  • uint32_t id
  • The id of the MIDI device
  • uint32_t type
  • The type of MIDI device (bluetooth, usb, or virtual)

####Ports

  • uint32_t inCount
  • the number of input ports for the device
  • uint32_t outCount
  • the number of output ports for the device
  • std:list ports
  • a list of port structures for the device

####Strings

  • std::string vendorName
  • the vendor name for the device
  • std::string productName
  • the product name for the device
  • std::string deviceName
  • the device name
  • std::string versionNumber
  • the device version number
  • std::string serialNumber
  • the serial number of the device

###midiPortStruct Represents a port for a MIDI device.

####Variables

  • std::string name
  • the name of the device
  • uint32_t number
  • the port number
  • uint32_t type
  • the type (in or out) of port

###struct mouseStruct mouseStruct stores a pooled set of data on the capabilities of all attached/detected mice, it is unused for the Saul portion of the Centurion project.

####Variables ####Parent

  • struct deviceStruct superDevice
  • The corresponding "parent" deviceStruct for the mouseStruct
  • uint32_t deviceIndex
  • The superDevice's index in detectedDevices

####Properties

  • uint32_t anyRightLeftSwapped
  • True if any of the attached mice have their left/right click buttons swapped, false otherwise
  • uint32_t anyVerticalWheelPresent
  • True if any of the attached mice have a vertical wheel, false otherwise
  • uint32_t anyHorizontalWheelPresent
  • True if any of the attached mice have a horizontal wheel, false otherwise
  • uint32_t maxNumberOfButtons
  • The number of buttons found on the detected/attached mouse with the most buttons

#Classes ##Cylon.java ###Cylon The Cylon class is a Java translation of the native code cylonStruct. All fields and their associated values/meanings are carried over with the following exceptions:

  • int testMask
  • this field is used for testing purposes only in the Java side of Saul
  • int keycode
  • this field is used for handling key events for setting the state of a Controller before exporting it to native code
  • Context context
  • this field is passed to the constructor of a new Cylon by the calling application, this allows the Cylon to access various system services, etc. to retrieve information about the device and user.
  • Application app
  • this field is passed to the constructor of a new Cylon by the calling application, this allows the Cylon to access various fields of the application without having to communicate back and forth at run time.
  • Activity activity
  • this field is passed to the constructor of a new Cylon by the calling application, this allows the Cylon to access various fields of the activity without having to communicate back and forth at run time.
  • public final static String cameraRationale
  • this string presents the user with a permissions rationale to explain why the app needs access to the camera permission
  • public final static String contactsRationale
  • this string presents the user with a permissions rationale to explain why the app needs access to the contacts permission
  • public final static int REQUEST_CAMERA
  • the request code for requesting the camera permission
  • public final static int REQUEST_CONTACTS
  • the request code for requesting the contacts permission
  • public final static int REQUEST_BLUETOOTH
  • the request code for requesting the bluetooth permission
  • public final static int REQUEST_LOCATION
  • the request code for requesting the location permission
  • public final static int REQUEST_STORAGE
  • the request code for requesting the storage permission
  • public boolean nonAnswersDone
  • flag for keeping track of if producers that do not require a specific permission to execute are completed
  • public boolean cameraAnswered
  • flag for keeping track of if the user has either declined or granted camera permission
  • public boolean contactsAnswered
  • flag for keeping track of if the user has either declined or granted contacts permission
  • public boolean bluetoothAnswered
  • flag for keeping track of if the user has either declined or granted bluetooth permission
  • public boolean storageAnswered
  • flag for keeping track of if the user has either declined or granted storage permission
  • public boolean locationAnswered
  • flag for keeping track of if the user has either declined or granted location permission
  • public boolean logged
  • flag for keeping track of if the Cylon's contents have been logged yet or not
  • private boolean nativeConverted
  • flag for keeping track of if the Cylon's contents have been converted to a cylonStruct yet or not

###CpuFilter An inner class in Cylon's produceProcessorInfo() function. Implements the FileFilter interface to help distinguish files that contain the pattern "cpu[0-9]+" within the provided filepath of its accept() method. Return's true if the file name in a given directory matches, and false otherwise.

##Device.java ###Device The Device class is a Java translation of the native code deviceStruct. All fields and their associated values/meanings are carried over.

##Display.java ###Display The Display class is a Java translation of the native code displayStruct. All fields and their associated values/meanings are carried over.

##Controller.java ###Controller The Controller class is a Java translation of the native code controllerStruct. All fields and their associated values/meanings are carried over with the following exceptions:

  • int keycode
  • This field is used for key listening to help set the state of a given controller before passing it to native code.

##Mouse.java ###Mouse The Mouse class is a Java translation of the native code mouseStruct. All fields and their associated values/meanings are carried over, currently unused.

##Sensor.java ###Sensor The Sensor class is a Java pre-translation of the native code sensorStruct.

####Variables ####Parent

  • Device superDevice
  • The Device object that maps to this Sensor, contains more general information about the Sensor as a device.

####Data

  • int minDelay
  • The minimum delay allowed between two events, measured in microseconds. This value may also be 0 if the sensor only returns new data when actively observing a change in its readings.
  • int type
  • The specific type of sensor this object holds data for, based on the Android mapping found here.
  • int version
  • The release number of the given sensor
  • String vendor
  • The name of the vendor for the given sensor
  • String name
  • The assigned name for the given sensor
  • float power
  • the power drawn by the sensor, measured in mA
  • float resolution
  • the resolution the scanner uses for scans
  • int fifoMaxEventCount
  • the max number of events the sensor can have batched, a value of 0 indicates batch mode is not supported, this value is not guaranteed as other sensors may share the same batch space at run time
  • int fifoReservedEventCount
  • guaranteed minimum number of FIFO events for the sensor that can be batched
  • String stringType
  • a String representation of the sensor's type
  • int maxDelay
  • The delay between two sensor events measured in microseconds for the lowest frequency the given sensor can operate with. Used only for continuous and on-change sensors, and invalid when less than 1.
  • int reportingMode
  • The reporting mode for the given sensor, based on the Android mapping found here.
  • int isWakeUpSensor
  • denotes if the given sensor is a wake up sensor

##Storage.java ###Storage The Storage class is a Java pre-translation of the native storageStruct.

####Variables ####Parent

  • Device superDevice
  • Device object which maps to this Storage object

####Properties

  • String path
  • file system path to the storage location
  • long bytesAvails
  • free space on the storage device, measured in bytes
  • long totalBytes
  • total size of the storage device, measured in bytes
  • boolean isEmulated
  • denotes if the storage device is emulated storage

##Midi.java ###Midi The Midi class is a Java pre-translation of the native midiStruct.

####Variables ####Parent

  • Device superDevice
  • Device object which maps to this Midi object

####ID

  • int type
  • the type (virtual, usb, bluetooth) of MIDI device
  • int id
  • id value for the given MIDI device

####Ports

  • int outCount
  • the number of output ports on the device
  • int inCount
  • the number of input ports on the device
  • LinkedList ports
  • a linked list of all of the ports associated with this device

####Strings

  • String vendorName
  • the vendor name of the device
  • String productName
  • the product name of the device
  • String deviceName
  • the name of the device
  • String serialNumber
  • the serial number of the device
  • String versionNumber
  • the version number of the device

###MidiPort Represents a port for a given MIDI device.

####Variables

  • String name
  • the name of the port
  • int number
  • the port number
  • int type
  • the type of port (in/out)
⚠️ **GitHub.com Fallback** ⚠️