All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.atsushieno.ktmidi.ci.MidiCIClientPropertyRules.kt Maven / Gradle / Ivy

package dev.atsushieno.ktmidi.ci

/**
 * To make sense implementing Property Exchange, but to not limit to Common Rules for PE,
 * we have extra set of requirements to support property meta system:
 *
 * - Every property header byte array must be able to provide one single property ID
 * - The system can provide a list of property IDs. It is asynchronous operation.
 * - When the list of property IDs are acquired, it must be notified as `propertyCatalogUpdated`
 *   - The list acquisition must be automatically detected.
 */
interface MidiCIClientPropertyRules {
    fun createDataRequestHeader(propertyId: String, fields: Map): List

    fun createSubscriptionHeader(propertyId: String, fields: Map): List

    fun getPropertyIdForHeader(header: List): String

    fun getMetadataList(): List?

    fun requestPropertyList(group: Byte)

    fun propertyValueUpdated(propertyId: String, data: List)

    fun getHeaderFieldInteger(header: List, field: String): Int?
    fun getHeaderFieldString(header: List, field: String): String?

    // To avoid too much Common Rules for PE exposure, we need to cast this Any argument as Subscription in the implementation.
    fun processPropertySubscriptionResult(subscriptionContext: Any, msg: Message.SubscribePropertyReply)

    fun getSubscribedProperty(msg: Message.SubscribeProperty): String?

    fun createStatusHeader(status: Int): List
    // FIXME: too much exposure of Common Rules for PE
    fun getUpdatedValue(existing: PropertyValue?, isPartial: Boolean, mediaType: String, body: List): Pair>
    // FIXME: too much exposure of Common Rules for PE
    fun encodeBody(data: List, encoding: String?): List
    fun decodeBody(header: List, body: List): List

    val propertyCatalogUpdated: MutableList<() -> Unit>
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy