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

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

package dev.atsushieno.ktmidi.ci

import dev.atsushieno.ktmidi.ci.propertycommonrules.SubscriptionEntry

/**
 * This interface abstracts how MIDI-CI Property Exchange Responder (host, service, whatever)
 * handles the incoming inquiries.
 *
 * M2-103-UM (Common Rules for Property Exchange) specification formalizes how PE header and body
 * content binaries are interpreted. PE header section is always JSON (of some restricted form),
 * and body content may differ, as per its mime type that the (JSON) schema indicates.
 *
 * It should be noted that Common Rules for PE is technically just a format option for
 * the PE content (header and body) and there may be other formats (especially in the future
 * set of specifications).
 * Therefore, it is technically important to extract this interface out from CommonPropertyService.
 */
interface MidiCIServicePropertyRules {
    fun getPropertyIdForHeader(header: List): String
    fun createUpdateNotificationHeader(propertyId: String, fields: Map): List
    fun getMetadataList(): List?
    fun getPropertyData(msg: Message.GetPropertyData) : Result
    fun setPropertyData(msg: Message.SetPropertyData) : Result
    fun subscribeProperty(msg: Message.SubscribeProperty) : Result
    fun addMetadata(property: PropertyMetadata)
    fun removeMetadata(propertyId: String)
    // FIXME: too much exposure of Common Rules for PE
    fun encodeBody(data: List, encoding: String?): List
    fun decodeBody(header: List, body: List): List
    fun getHeaderFieldString(header: List, field: String): String?
    fun createShutdownSubscriptionHeader(propertyId: String): List

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy