From e07c96e663b7d8a9501a34f4805ab80053f52f20 Mon Sep 17 00:00:00 2001 From: fulup Date: Tue, 18 Jul 2017 16:33:01 +0200 Subject: Update Installation Documentation --- conf.d/openapi-schema.json | 764 ------------------------------------- conf.d/openapi/openapi-schema.json | 764 +++++++++++++++++++++++++++++++++++++ ucs2-interface/ucs_api_def.json | 202 ++++++++++ 3 files changed, 966 insertions(+), 764 deletions(-) delete mode 100644 conf.d/openapi-schema.json create mode 100644 conf.d/openapi/openapi-schema.json create mode 100644 ucs2-interface/ucs_api_def.json diff --git a/conf.d/openapi-schema.json b/conf.d/openapi-schema.json deleted file mode 100644 index 6629c7c..0000000 --- a/conf.d/openapi-schema.json +++ /dev/null @@ -1,764 +0,0 @@ -{ - "title": "A JSON Schema for OpenApi 3.0 API.", - "id": "http://www.openapis.org/v3/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "openapi", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "openapi": { - "type": "string", - "enum": [ - "3.0.0" - ], - "description": "Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be major.minor.patch, where patch versions must be compatible with the existing major.minor tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding major.minor (3.0.*). Patch versions will correspond to patches of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "components": { - "$ref": "#/definitions/components" - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "contact": { - "type": "object", - "description": "Contact information for the exposed API.", - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information. MUST be in the format of a URL." - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization. Must be in the format of an email address." - } - } - }, - "license": { - "type": "object", - "description": "License information for the exposed API.", - "required": [ "name" ], - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "name": { - "type": "string", - "description": "The license name used for the API." - }, - "url": { - "type": "string", - "description": "A URL to the license used for the API. MUST be in the format of a URL." - } - } - }, - "info": { - "type": "object", - "description": "The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the OpenApi-UI for convenience.", - "required": [ - "title", - "version" - ], - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "The title of the application." - }, - "description": { - "type": "string", - "description": "A short description of the application. CommonMark syntax can be used for rich text representation." - }, - "termsOfService": { - "type": "string", - "description": "A URL to the Terms of Service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - }, - "version": { - "type": "string", - "description": "Provides the version of the application API (not to be confused with the specification version)." - } - } - }, - "server": { - "type": "object", - "description": "An object representing a Server.", - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "url": { - "type": "string", - "description": "A absolute URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are optional and specified by the Host Template Parameter syntax. Template substitutions will be made when a variable is named in {brackets}." - }, - "description": { - "type": "string", - "description": "An optional string describing the host designated by the URL." - }, - "variables": { - "$ref": "#/definitions/serverVariables" - } - } - }, - "paths": { - "type": "object", - "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.", - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "pathItem": { - "type": "object", - "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.", - "properties": { - "$ref": { - "type": "string", - "description": "Allows for an external definition of this path item. The referenced structure MUST be in the format of a Path Item Object. If there are conflicts between the referenced definition and this Path Item's definition, the behavior is undefined." - }, - "summary": { - "type": "string", - "description": "An optional, string summary, intended to apply to all operations in this path." - }, - "description": { - "type": "string", - "description": "An optional, string description, intended to apply to all operations in this path. CommonMark syntax can be used for rich text representation." - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "trace": { - "$ref": "#/definitions/operation" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - } - }, - "parameters": { - "type": "array", - "items": { - "oneOf": [ - { "$ref": "#/definitions/parameter" }, - { "$ref": "#/definitions/reference" } - ] - } - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "operation": { - "type": "object", - "description": "Describes a single API operation on a path.", - "required": [ "responses" ], - "properties": { - "tags": { - "type": "array", - "items": [ - { "type": "string" } - ], - "description": "A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier." - }, - "summary": { - "type": "string", - "description": "A short summary of what the operation does. For maximum readability in editing or documentation generation tools, this field SHOULD be less than 120 characters." - }, - "description": { - "type": "string", - "description": "A verbose explanation of the operation behavior. CommonMark syntax can be used for rich text representation." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions." - }, - "parameters": { - "type": "array", - "items": { - "oneOf": [ - { "$ref": "#/definitions/parameter" }, - { "$ref": "#/definitions/reference" } - ] - }, - "description": "A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters." - }, - "requestBody": { - "oneOf": [ - { "$ref": "#/definitions/requestBody" }, - { "$ref": "#/definitions/reference" } - ], - "description": "The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers." - }, - "responses": { - "$ref": "#/definitions/responses", - "description": "Required. The list of possible responses as they are returned from executing this operation." - }, - "callbacks": { - "$ref": "#/definitions/callbacks", - "description": "The list of possible callbacks as they are returned from executing this operation." - }, - "deprecated": { - "type": "boolean", - "description": "Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false." - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - } - }, - "servers": { - "$ref": "#/definitions/server" - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "parameter": { - "type": "object", - "description": "Describes a single operation parameter.", - "required": [ "name", "in" ], - "properties": { - "name": { - "type": "string", - "description": "" - }, - "in": { - "type": "string", - "enum": [ "query", "header", "path", "cookie" ], - "description": "The location of the parameter." - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. CommonMark syntax can be used for rich text representation." - }, - "required": { - "type": "boolean", - "description": "Determines whether this parameter is mandatory. If the parameter location is \"path\", this property is required and its value MUST be true. Otherwise, the property MAY be included and its default value is false.", - "default": "false" - }, - "deprecated": { - "type": "boolean", - "description": "Specifies that a parameter is deprecated and SHOULD be transitioned out of usage." - }, - "allowEmptyValue": { - "type": "boolean", - "description": "Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, if behavior is n/a, the value of allowEmptyValue SHALL be ignored." - }, - "schema": { - "anyOf": [ - { "$ref": "#/definitions/schema" }, - { "$ref": "#/definitions/reference" } - ] - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "reference": { - "type": "object", - "description": "A simple object to allow referencing other components in the specification, internally and externally", - "required": [ "$ref" ], - "properties": { - "$ref": { - "type": "string", - "description": "The reference string" - } - } - }, - "responses": { - "type": "object", - "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.", - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "response": { - "type": "object", - "description": "Describes a single response from an API Operation, including design-time, static links to operations based on the response.", - "required": [ "description" ], - "properties": { - "description": { - "type": "string", - "description": "A short description of the response. CommonMark syntax can be used for rich text representation." - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "content": { - "$ref": "#/definitions/content" - }, - "links": { - "$ref": "#/definitions/links" - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "requestBody": { - "type": "object", - "required": [ "content" ], - "properties": { - "description": { - "type": "string", - "description": "A brief description of the request body. This could contain examples of use. CommonMark syntax can be used for rich text representation." - }, - "content": { - "$ref": "#/definitions/content", - "description": "The content of the request body." - }, - "required": { - "type": "boolean", - "description": "Determines if the request body is required in the request. Defaults to false.", - "default": "false" - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "callbacks": { - "type": "object", - "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", - "patternProperties": { - ".*": { - "anyOf": [ - { "$ref": "#/definitions/callback" }, - { "$ref": "#/definitions/reference" } - ] - }, - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "callback": { - "type": "object", - "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", - "patternProperties": { - ".*": { - "$ref": "#/definitions/pathItem" - }, - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "headers": { - "type": "object", - "patternProperties": { - ".*": { - "anyOf": [ - { "$ref": "#/definitions/header" }, - { "$ref": "#/definitions/reference" } - ] - } - }, - "additionalProperties": false - }, - "header": { - "type": "object", - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. CommonMark syntax can be used for rich text representation." - }, - "required": { - "type": "boolean", - "description": "Determines whether this parameter is mandatory. If the parameter location is \"path\", this property is required and its value MUST be true. Otherwise, the property MAY be included and its default value is false.", - "default": "false" - }, - "deprecated": { - "type": "boolean", - "description": "Specifies that a parameter is deprecated and SHOULD be transitioned out of usage." - }, - "allowEmptyValue": { - "type": "boolean", - "description": "Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, if behavior is n/a, the value of allowEmptyValue SHALL be ignored." - } - }, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "additionalProperties": false - }, - "components": { - "type": "object", - "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.", - "patternProperties": { - "^[a-zA-Z0-9.\\-_]+$": { - "oneOf": [ - { "$ref": "#/definitions/definitions" }, - { "$ref": "#/definitions/responsesDefinitions" }, - { "$ref": "#/definitions/parametersDefinitions" }, - { "$ref": "#/definitions/requestBodyDefinitions" }, - { "$ref": "#/definitions/responseHeadersDefinitions" }, - { "$ref": "#/definitions/securityDefinitions" }, - { "$ref": "#/definitions/linkDefinitions" }, - { "$ref": "#/definitions/callbackDefinitions" } - ] - } - }, - "additionalProperties": false - }, - "securityRequirement": {}, - "tag": { - "type": "object", - "description": "Allows adding meta data to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag used there.", - "required": [ "name" ], - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "name": { - "type": "string", - "description": "The name of the tag." - }, - "description": { - "type": "string", - "description": "A short description for the tag. CommonMark syntax can be used for rich text representation." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - } - }, - "externalDocs": { - "type": "object", - "description": "Allows referencing an external resource for extended documentation.", - "required": [ "url" ], - "additionalProperties": false, - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A short description of the target documentation. CommonMark syntax can be used for rich text representation." - }, - "url": { - "type": "string", - "description": "The URL for the target documentation. Value MUST be in the format of a URL." - } - } - }, - "serverVariables": { - "type": "object", - "description": "", - "patternProperties": { - "^X-": { - "$ref": "#/definitions/vendorExtension" - }, - "": { - "$ref": "#/definitions/serverVariable" - } - }, - "additionalProperties": false - }, - "serverVariable": { - "type": "object", - "description": "An object representing a Host URL template", - "additionalProperties": false, - "required": [ "default" ], - "properties": { - "enums": { - "description": "An enumeration of primitive type values to be used if the substitution options are from a limited set.", - "type": "string" - }, - "default": { - "description": "The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is not supplied.", - "type": "string" - }, - "description": { - "type": "string", - "description": "An optional description for the template parameter." - } - } - }, - "content": { - "type": "object", - "description": "Describes a set of supported media types. A Content Object can be used in Request Body Object, Parameter Objects, Header Objects, and Response Objects.", - "patternProperties": { - ".*": { - - } - } - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "An object to hold schemas for data types that can be consumed and produced by operations. These data types can be primitives, arrays or models." - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - } - } -} - diff --git a/conf.d/openapi/openapi-schema.json b/conf.d/openapi/openapi-schema.json new file mode 100644 index 0000000..6629c7c --- /dev/null +++ b/conf.d/openapi/openapi-schema.json @@ -0,0 +1,764 @@ +{ + "title": "A JSON Schema for OpenApi 3.0 API.", + "id": "http://www.openapis.org/v3/schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "required": [ + "openapi", + "info", + "paths" + ], + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "openapi": { + "type": "string", + "enum": [ + "3.0.0" + ], + "description": "Specifies the OpenAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be major.minor.patch, where patch versions must be compatible with the existing major.minor tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding major.minor (3.0.*). Patch versions will correspond to patches of this document." + }, + "info": { + "$ref": "#/definitions/info" + }, + "servers": { + "type": "array", + "items": { + "$ref": "#/definitions/server" + }, + "uniqueItems": true + }, + "paths": { + "$ref": "#/definitions/paths" + }, + "components": { + "$ref": "#/definitions/components" + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + }, + "uniqueItems": true + }, + "tags": { + "type": "array", + "items": { + "$ref": "#/definitions/tag" + }, + "uniqueItems": true + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + }, + "definitions": { + "vendorExtension": { + "description": "Any property starting with x- is valid.", + "additionalProperties": true, + "additionalItems": true + }, + "contact": { + "type": "object", + "description": "Contact information for the exposed API.", + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "name": { + "type": "string", + "description": "The identifying name of the contact person/organization." + }, + "url": { + "type": "string", + "description": "The URL pointing to the contact information. MUST be in the format of a URL." + }, + "email": { + "type": "string", + "description": "The email address of the contact person/organization. Must be in the format of an email address." + } + } + }, + "license": { + "type": "object", + "description": "License information for the exposed API.", + "required": [ "name" ], + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "name": { + "type": "string", + "description": "The license name used for the API." + }, + "url": { + "type": "string", + "description": "A URL to the license used for the API. MUST be in the format of a URL." + } + } + }, + "info": { + "type": "object", + "description": "The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the OpenApi-UI for convenience.", + "required": [ + "title", + "version" + ], + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "title": { + "type": "string", + "description": "The title of the application." + }, + "description": { + "type": "string", + "description": "A short description of the application. CommonMark syntax can be used for rich text representation." + }, + "termsOfService": { + "type": "string", + "description": "A URL to the Terms of Service for the API." + }, + "contact": { + "$ref": "#/definitions/contact" + }, + "license": { + "$ref": "#/definitions/license" + }, + "version": { + "type": "string", + "description": "Provides the version of the application API (not to be confused with the specification version)." + } + } + }, + "server": { + "type": "object", + "description": "An object representing a Server.", + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "url": { + "type": "string", + "description": "A absolute URL to the target host. This URL supports template variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI Specification is being served. Templates are optional and specified by the Host Template Parameter syntax. Template substitutions will be made when a variable is named in {brackets}." + }, + "description": { + "type": "string", + "description": "An optional string describing the host designated by the URL." + }, + "variables": { + "$ref": "#/definitions/serverVariables" + } + } + }, + "paths": { + "type": "object", + "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.", + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + }, + "^/": { + "$ref": "#/definitions/pathItem" + } + }, + "additionalProperties": false + }, + "pathItem": { + "type": "object", + "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.", + "properties": { + "$ref": { + "type": "string", + "description": "Allows for an external definition of this path item. The referenced structure MUST be in the format of a Path Item Object. If there are conflicts between the referenced definition and this Path Item's definition, the behavior is undefined." + }, + "summary": { + "type": "string", + "description": "An optional, string summary, intended to apply to all operations in this path." + }, + "description": { + "type": "string", + "description": "An optional, string description, intended to apply to all operations in this path. CommonMark syntax can be used for rich text representation." + }, + "get": { + "$ref": "#/definitions/operation" + }, + "put": { + "$ref": "#/definitions/operation" + }, + "post": { + "$ref": "#/definitions/operation" + }, + "delete": { + "$ref": "#/definitions/operation" + }, + "options": { + "$ref": "#/definitions/operation" + }, + "head": { + "$ref": "#/definitions/operation" + }, + "patch": { + "$ref": "#/definitions/operation" + }, + "trace": { + "$ref": "#/definitions/operation" + }, + "servers": { + "type": "array", + "items": { + "$ref": "#/definitions/server" + } + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { "$ref": "#/definitions/parameter" }, + { "$ref": "#/definitions/reference" } + ] + } + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "operation": { + "type": "object", + "description": "Describes a single API operation on a path.", + "required": [ "responses" ], + "properties": { + "tags": { + "type": "array", + "items": [ + { "type": "string" } + ], + "description": "A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier." + }, + "summary": { + "type": "string", + "description": "A short summary of what the operation does. For maximum readability in editing or documentation generation tools, this field SHOULD be less than 120 characters." + }, + "description": { + "type": "string", + "description": "A verbose explanation of the operation behavior. CommonMark syntax can be used for rich text representation." + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "operationId": { + "type": "string", + "description": "Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions." + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { "$ref": "#/definitions/parameter" }, + { "$ref": "#/definitions/reference" } + ] + }, + "description": "A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters." + }, + "requestBody": { + "oneOf": [ + { "$ref": "#/definitions/requestBody" }, + { "$ref": "#/definitions/reference" } + ], + "description": "The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers." + }, + "responses": { + "$ref": "#/definitions/responses", + "description": "Required. The list of possible responses as they are returned from executing this operation." + }, + "callbacks": { + "$ref": "#/definitions/callbacks", + "description": "The list of possible callbacks as they are returned from executing this operation." + }, + "deprecated": { + "type": "boolean", + "description": "Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false." + }, + "security": { + "type": "array", + "items": { + "$ref": "#/definitions/securityRequirement" + } + }, + "servers": { + "$ref": "#/definitions/server" + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "parameter": { + "type": "object", + "description": "Describes a single operation parameter.", + "required": [ "name", "in" ], + "properties": { + "name": { + "type": "string", + "description": "" + }, + "in": { + "type": "string", + "enum": [ "query", "header", "path", "cookie" ], + "description": "The location of the parameter." + }, + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. CommonMark syntax can be used for rich text representation." + }, + "required": { + "type": "boolean", + "description": "Determines whether this parameter is mandatory. If the parameter location is \"path\", this property is required and its value MUST be true. Otherwise, the property MAY be included and its default value is false.", + "default": "false" + }, + "deprecated": { + "type": "boolean", + "description": "Specifies that a parameter is deprecated and SHOULD be transitioned out of usage." + }, + "allowEmptyValue": { + "type": "boolean", + "description": "Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, if behavior is n/a, the value of allowEmptyValue SHALL be ignored." + }, + "schema": { + "anyOf": [ + { "$ref": "#/definitions/schema" }, + { "$ref": "#/definitions/reference" } + ] + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "reference": { + "type": "object", + "description": "A simple object to allow referencing other components in the specification, internally and externally", + "required": [ "$ref" ], + "properties": { + "$ref": { + "type": "string", + "description": "The reference string" + } + } + }, + "responses": { + "type": "object", + "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.", + "patternProperties": { + "^([0-9]{3})$|^(default)$": { + "$ref": "#/definitions/responseValue" + }, + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "responseValue": { + "oneOf": [ + { + "$ref": "#/definitions/response" + }, + { + "$ref": "#/definitions/reference" + } + ] + }, + "response": { + "type": "object", + "description": "Describes a single response from an API Operation, including design-time, static links to operations based on the response.", + "required": [ "description" ], + "properties": { + "description": { + "type": "string", + "description": "A short description of the response. CommonMark syntax can be used for rich text representation." + }, + "headers": { + "$ref": "#/definitions/headers" + }, + "content": { + "$ref": "#/definitions/content" + }, + "links": { + "$ref": "#/definitions/links" + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "requestBody": { + "type": "object", + "required": [ "content" ], + "properties": { + "description": { + "type": "string", + "description": "A brief description of the request body. This could contain examples of use. CommonMark syntax can be used for rich text representation." + }, + "content": { + "$ref": "#/definitions/content", + "description": "The content of the request body." + }, + "required": { + "type": "boolean", + "description": "Determines if the request body is required in the request. Defaults to false.", + "default": "false" + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "callbacks": { + "type": "object", + "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", + "patternProperties": { + ".*": { + "anyOf": [ + { "$ref": "#/definitions/callback" }, + { "$ref": "#/definitions/reference" } + ] + }, + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "callback": { + "type": "object", + "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", + "patternProperties": { + ".*": { + "$ref": "#/definitions/pathItem" + }, + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "headers": { + "type": "object", + "patternProperties": { + ".*": { + "anyOf": [ + { "$ref": "#/definitions/header" }, + { "$ref": "#/definitions/reference" } + ] + } + }, + "additionalProperties": false + }, + "header": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "A brief description of the parameter. This could contain examples of use. CommonMark syntax can be used for rich text representation." + }, + "required": { + "type": "boolean", + "description": "Determines whether this parameter is mandatory. If the parameter location is \"path\", this property is required and its value MUST be true. Otherwise, the property MAY be included and its default value is false.", + "default": "false" + }, + "deprecated": { + "type": "boolean", + "description": "Specifies that a parameter is deprecated and SHOULD be transitioned out of usage." + }, + "allowEmptyValue": { + "type": "boolean", + "description": "Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, if behavior is n/a, the value of allowEmptyValue SHALL be ignored." + } + }, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "additionalProperties": false + }, + "components": { + "type": "object", + "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.", + "patternProperties": { + "^[a-zA-Z0-9.\\-_]+$": { + "oneOf": [ + { "$ref": "#/definitions/definitions" }, + { "$ref": "#/definitions/responsesDefinitions" }, + { "$ref": "#/definitions/parametersDefinitions" }, + { "$ref": "#/definitions/requestBodyDefinitions" }, + { "$ref": "#/definitions/responseHeadersDefinitions" }, + { "$ref": "#/definitions/securityDefinitions" }, + { "$ref": "#/definitions/linkDefinitions" }, + { "$ref": "#/definitions/callbackDefinitions" } + ] + } + }, + "additionalProperties": false + }, + "securityRequirement": {}, + "tag": { + "type": "object", + "description": "Allows adding meta data to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag used there.", + "required": [ "name" ], + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "name": { + "type": "string", + "description": "The name of the tag." + }, + "description": { + "type": "string", + "description": "A short description for the tag. CommonMark syntax can be used for rich text representation." + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + } + } + }, + "externalDocs": { + "type": "object", + "description": "Allows referencing an external resource for extended documentation.", + "required": [ "url" ], + "additionalProperties": false, + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "description": { + "type": "string", + "description": "A short description of the target documentation. CommonMark syntax can be used for rich text representation." + }, + "url": { + "type": "string", + "description": "The URL for the target documentation. Value MUST be in the format of a URL." + } + } + }, + "serverVariables": { + "type": "object", + "description": "", + "patternProperties": { + "^X-": { + "$ref": "#/definitions/vendorExtension" + }, + "": { + "$ref": "#/definitions/serverVariable" + } + }, + "additionalProperties": false + }, + "serverVariable": { + "type": "object", + "description": "An object representing a Host URL template", + "additionalProperties": false, + "required": [ "default" ], + "properties": { + "enums": { + "description": "An enumeration of primitive type values to be used if the substitution options are from a limited set.", + "type": "string" + }, + "default": { + "description": "The default value to use for substitution if an alternate value is not specified, and will be sent if an alternative value is not supplied.", + "type": "string" + }, + "description": { + "type": "string", + "description": "An optional description for the template parameter." + } + } + }, + "content": { + "type": "object", + "description": "Describes a set of supported media types. A Content Object can be used in Request Body Object, Parameter Objects, Header Objects, and Response Objects.", + "patternProperties": { + ".*": { + + } + } + }, + "definitions": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "description": "An object to hold schemas for data types that can be consumed and produced by operations. These data types can be primitives, arrays or models." + }, + "schema": { + "type": "object", + "description": "A deterministic version of a JSON Schema object.", + "patternProperties": { + "^x-": { + "$ref": "#/definitions/vendorExtension" + } + }, + "properties": { + "$ref": { + "type": "string" + }, + "format": { + "type": "string" + }, + "title": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/title" + }, + "description": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/description" + }, + "default": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/default" + }, + "multipleOf": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" + }, + "maximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" + }, + "exclusiveMaximum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" + }, + "minimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" + }, + "exclusiveMinimum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" + }, + "maxLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minLength": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "pattern": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" + }, + "maxItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minItems": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "uniqueItems": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" + }, + "maxProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" + }, + "minProperties": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" + }, + "required": { + "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" + }, + "enum": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" + }, + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "boolean" + } + ], + "default": {} + }, + "type": { + "$ref": "http://json-schema.org/draft-04/schema#/properties/type" + }, + "items": { + "anyOf": [ + { + "$ref": "#/definitions/schema" + }, + { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + } + ], + "default": {} + }, + "allOf": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "properties": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/schema" + }, + "default": {} + }, + "discriminator": { + "type": "string" + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "xml": { + "$ref": "#/definitions/xml" + }, + "externalDocs": { + "$ref": "#/definitions/externalDocs" + }, + "example": {} + }, + "additionalProperties": false + } + } +} + diff --git a/ucs2-interface/ucs_api_def.json b/ucs2-interface/ucs_api_def.json new file mode 100644 index 0000000..9b99843 --- /dev/null +++ b/ucs2-interface/ucs_api_def.json @@ -0,0 +1,202 @@ +{ + "openapi": "3.0.0", + "info": { + "description": "", + "title": "monitor", + "version": "1.0", + "x-binding-c-generator": { + "api": "monitor", + "version": 2, + "prefix": "f_", + "postfix": "", + "preinit": null, + "init": null, + "onevent": null, + "scope": "static", + "private": true + } + }, + "servers": [ + { + "url": "ws://{host}:{port}/api/monitor", + "description": "The API server.", + "variables": { + "host": { + "default": "localhost" + }, + "port": { + "default": "1234" + } + }, + "x-afb-events": [ + { + "$ref": "#/components/schemas/afb-event" + } + ] + } + ], + "components": { + "schemas": { + "afb-reply": { + "$ref": "#/components/schemas/afb-reply-v1" + }, + "afb-event": { + "$ref": "#/components/schemas/afb-event-v1" + }, + "afb-reply-v1": { + "title": "Generic response.", + "type": "object", + "required": [ "jtype", "request" ], + "properties": { + "jtype": { + "type": "string", + "const": "afb-reply" + }, + "request": { + "type": "object", + "required": [ "status" ], + "properties": { + "status": { "type": "string" }, + "info": { "type": "string" }, + "token": { "type": "string" }, + "uuid": { "type": "string" }, + "reqid": { "type": "string" } + } + }, + "response": { "type": "object" } + } + }, + "afb-event-v1": { + "type": "object", + "required": [ "jtype", "event" ], + "properties": { + "jtype": { + "type": "string", + "const": "afb-event" + }, + "event": { "type": "string" }, + "data": { "type": "object" } + } + }, + "set-verbosity": { + "anyOf": [ + { "$ref": "#/components/schemas/verbosity-map" }, + { "$ref": "#/components/schemas/verbosity-level" } + ] + }, + "get-request": { + "type": "object", + "properties": { + "verbosity": { "$ref": "#/components/schemas/get-verbosity" }, + "apis": { "$ref": "#/components/schemas/get-apis" } + } + }, + "get-response": { + "type": "object", + "properties": { + "verbosity": { "$ref": "#/components/schemas/verbosity-map" }, + "apis": { "type": "object" } + } + }, + "get-verbosity": { + "anyOf": [ + { "type": "boolean" }, + { "type": "array", "items": { "type": "string" } }, + { "type": "object" } + ] + }, + "get-apis": { + "anyOf": [ + { "type": "boolean" }, + { "type": "array", "items": { "type": "string" } }, + { "type": "object" } + ] + }, + "verbosity-map": { + "type": "object", + "patternProperties": { "^.*$": { "$ref": "#/components/schemas/verbosity-level" } } + }, + "verbosity-level": { + "enum": [ "debug", 3, "info", 2, "notice", "warning", 1, "error", 0 ] + } + }, + "x-permissions": { + "set": { + "permission": "urn:AGL:permission:monitor:public:set" + }, + "get": { + "permission": "urn:AGL:permission:monitor:public:get" + }, + "get-or-set": { + "anyOf": [ + { "$ref": "#/components/x-permissions/get" }, + { "$ref": "#/components/x-permissions/set" } + ] + } + } + }, + "paths": { + "/get": { + "description": "Get monitoring data.", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/get-or-set" + }, + "parameters": [ + { + "in": "query", + "name": "verbosity", + "required": false, + "schema": { "$ref": "#/components/schemas/get-verbosity" } + }, + { + "in": "query", + "name": "apis", + "required": false, + "schema": { "$ref": "#/components/schemas/get-apis" } + } + ], + "responses": { + "200": { + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/afb-reply" + } + } + } + } + } + } + }, + "/set": { + "description": "Set monitoring actions.", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/set" + }, + "parameters": [ + { + "in": "query", + "name": "verbosity", + "required": false, + "schema": { "$ref": "#/components/schemas/set-verbosity" } + } + ], + "responses": { + "200": { + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/afb-reply" + } + } + } + } + } + } + } + } +} -- cgit 1.2.3-korg From e177a9e1fa78ef9d0ec7de851f414f9f9efd131d Mon Sep 17 00:00:00 2001 From: fulup Date: Tue, 18 Jul 2017 18:40:10 +0200 Subject: Moving to APIV2 Work in Progress --- ucs2-afb/ucs_apihat.c | 74 --------------- ucs2-interface/ucs_api_def.json | 202 ---------------------------------------- 2 files changed, 276 deletions(-) delete mode 100644 ucs2-afb/ucs_apihat.c delete mode 100644 ucs2-interface/ucs_api_def.json diff --git a/ucs2-afb/ucs_apihat.c b/ucs2-afb/ucs_apihat.c deleted file mode 100644 index fd5d88f..0000000 --- a/ucs2-afb/ucs_apihat.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2016 "IoT.bzh" - * Author Fulup Ar Foll - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ucs_binding.h" - -const struct afb_binding_interface *afbIface; -struct afb_service afbSrv; - -/* - * array of the verbs exported to afb-daemon - */ -static const struct afb_verb_desc_v1 binding_verbs[] = { - /* VERB'S NAME SESSION MANAGEMENT FUNCTION TO CALL SHORT DESCRIPTION */ - { .name= "initialise", .session= AFB_SESSION_NONE, .callback= ucs2Init, .info= "Parse XML & initialise Unicens " }, - { .name= "setvol" , .session= AFB_SESSION_NONE, .callback= ucs2SetVol, .info= "Set Volume" }, - // { .name= "monitor" , .session= AFB_SESSION_NONE, .callback= ucs2Monitor, .info= "Subscribe to network error" }, - - - { .name= NULL } /* marker for end of the array */ -}; - -/* - * description of the binding for afb-daemon - */ -static const struct afb_binding binding_description = { - /* description conforms to VERSION 1 */ - .type= AFB_BINDING_VERSION_1, - .v1= { - .prefix= "UNICENS", - .info= "UNICENS MOST Control API", - .verbs = binding_verbs - } -}; - -// this is call when after all bindings are loaded - int afbBindingV1ServiceInit(struct afb_service service) { - afbSrv = service; - return (0); -} - -/* - * activation function for registering the binding called by afb-daemon - */ - const struct afb_binding *afbBindingV1Register(const struct afb_binding_interface *itf) { - afbIface= itf; - - return &binding_description; /* returns the description of the binding */ -} - diff --git a/ucs2-interface/ucs_api_def.json b/ucs2-interface/ucs_api_def.json deleted file mode 100644 index 9b99843..0000000 --- a/ucs2-interface/ucs_api_def.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "description": "", - "title": "monitor", - "version": "1.0", - "x-binding-c-generator": { - "api": "monitor", - "version": 2, - "prefix": "f_", - "postfix": "", - "preinit": null, - "init": null, - "onevent": null, - "scope": "static", - "private": true - } - }, - "servers": [ - { - "url": "ws://{host}:{port}/api/monitor", - "description": "The API server.", - "variables": { - "host": { - "default": "localhost" - }, - "port": { - "default": "1234" - } - }, - "x-afb-events": [ - { - "$ref": "#/components/schemas/afb-event" - } - ] - } - ], - "components": { - "schemas": { - "afb-reply": { - "$ref": "#/components/schemas/afb-reply-v1" - }, - "afb-event": { - "$ref": "#/components/schemas/afb-event-v1" - }, - "afb-reply-v1": { - "title": "Generic response.", - "type": "object", - "required": [ "jtype", "request" ], - "properties": { - "jtype": { - "type": "string", - "const": "afb-reply" - }, - "request": { - "type": "object", - "required": [ "status" ], - "properties": { - "status": { "type": "string" }, - "info": { "type": "string" }, - "token": { "type": "string" }, - "uuid": { "type": "string" }, - "reqid": { "type": "string" } - } - }, - "response": { "type": "object" } - } - }, - "afb-event-v1": { - "type": "object", - "required": [ "jtype", "event" ], - "properties": { - "jtype": { - "type": "string", - "const": "afb-event" - }, - "event": { "type": "string" }, - "data": { "type": "object" } - } - }, - "set-verbosity": { - "anyOf": [ - { "$ref": "#/components/schemas/verbosity-map" }, - { "$ref": "#/components/schemas/verbosity-level" } - ] - }, - "get-request": { - "type": "object", - "properties": { - "verbosity": { "$ref": "#/components/schemas/get-verbosity" }, - "apis": { "$ref": "#/components/schemas/get-apis" } - } - }, - "get-response": { - "type": "object", - "properties": { - "verbosity": { "$ref": "#/components/schemas/verbosity-map" }, - "apis": { "type": "object" } - } - }, - "get-verbosity": { - "anyOf": [ - { "type": "boolean" }, - { "type": "array", "items": { "type": "string" } }, - { "type": "object" } - ] - }, - "get-apis": { - "anyOf": [ - { "type": "boolean" }, - { "type": "array", "items": { "type": "string" } }, - { "type": "object" } - ] - }, - "verbosity-map": { - "type": "object", - "patternProperties": { "^.*$": { "$ref": "#/components/schemas/verbosity-level" } } - }, - "verbosity-level": { - "enum": [ "debug", 3, "info", 2, "notice", "warning", 1, "error", 0 ] - } - }, - "x-permissions": { - "set": { - "permission": "urn:AGL:permission:monitor:public:set" - }, - "get": { - "permission": "urn:AGL:permission:monitor:public:get" - }, - "get-or-set": { - "anyOf": [ - { "$ref": "#/components/x-permissions/get" }, - { "$ref": "#/components/x-permissions/set" } - ] - } - } - }, - "paths": { - "/get": { - "description": "Get monitoring data.", - "get": { - "x-permissions": { - "$ref": "#/components/x-permissions/get-or-set" - }, - "parameters": [ - { - "in": "query", - "name": "verbosity", - "required": false, - "schema": { "$ref": "#/components/schemas/get-verbosity" } - }, - { - "in": "query", - "name": "apis", - "required": false, - "schema": { "$ref": "#/components/schemas/get-apis" } - } - ], - "responses": { - "200": { - "description": "A complex object array response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/afb-reply" - } - } - } - } - } - } - }, - "/set": { - "description": "Set monitoring actions.", - "get": { - "x-permissions": { - "$ref": "#/components/x-permissions/set" - }, - "parameters": [ - { - "in": "query", - "name": "verbosity", - "required": false, - "schema": { "$ref": "#/components/schemas/set-verbosity" } - } - ], - "responses": { - "200": { - "description": "A complex object array response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/afb-reply" - } - } - } - } - } - } - } - } -} -- cgit 1.2.3-korg From ffbadf58291dd1c66acc7b17add759291e14f311 Mon Sep 17 00:00:00 2001 From: fulup Date: Wed, 19 Jul 2017 15:18:25 +0200 Subject: Update Installation Documentation --- nbproject/configurations.xml | 17 --------- ucs2-afb/CMakeLists.txt | 28 +++++++++++---- ucs2-afb/ucs_apidef.h | 86 ++++++++++++++++++++++++++++++++++++++++++++ ucs2-afb/ucs_apidef.json | 39 ++++++++++++++------ ucs2-afb/ucs_apihat.c | 21 +++++++++++ 5 files changed, 158 insertions(+), 33 deletions(-) create mode 100644 ucs2-afb/ucs_apidef.h create mode 100644 ucs2-afb/ucs_apihat.c diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 4ff307d..5d4dfd9 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -35,7 +35,6 @@ libmostvolume.cpp - ucs_apihat.c ucs_binding.c ucs_binding.new.c @@ -283,13 +282,6 @@ - - - - ucs2_EXPORTS - - - @@ -675,15 +667,6 @@ - - - - ucs2-afb - ../../../opt/include/afb - build/ucs2-afb - - - diff --git a/ucs2-afb/CMakeLists.txt b/ucs2-afb/CMakeLists.txt index ee5099e..9bac628 100644 --- a/ucs2-afb/CMakeLists.txt +++ b/ucs2-afb/CMakeLists.txt @@ -16,28 +16,44 @@ # limitations under the License. ########################################################################### + +# Generate API-v2 hat from OpenAPI json definition +macro(SET_TARGET_GENSKEL TARGET_NAME API_DEF_NAME) + add_custom_command(OUTPUT ${API_DEF_NAME}.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${API_DEF_NAME}.json + COMMAND afb-genskel ${API_DEF_NAME}.json >${API_DEF_NAME}.h + ) + add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h) + add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI) + +endmacro(SET_TARGET_GENSKEL) + # Add target to project dependency list -PROJECT_TARGET_ADD(ucs2) +PROJECT_TARGET_ADD(ucs2-afb) # Define project Targets - ADD_LIBRARY(ucs2 MODULE ucs_binding.c ucs_apihat.c) + ADD_LIBRARY(${TARGET_NAME} MODULE ucs_apihat.c ucs_binding.c ) + + # Generate API-v2 hat from OpenAPI json definition + SET_TARGET_GENSKEL(${TARGET_NAME} ucs_apidef) # Binder exposes a unique public entry point - SET_TARGET_PROPERTIES(ucs2 PROPERTIES + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "afb-" LABELS "BINDING" LINK_FLAGS ${BINDINGS_LINK_FLAG} - OUTPUT_NAME ${TARGET_NAME} + OUTPUT_NAME ucs2 ) # Library dependencies (include updates automatically) - TARGET_LINK_LIBRARIES(ucs2 + TARGET_LINK_LIBRARIES(${TARGET_NAME} ucs2-inter ${link_libraries} ) # installation directory - INSTALL(TARGETS ucs2 + INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR}) diff --git a/ucs2-afb/ucs_apidef.h b/ucs2-afb/ucs_apidef.h new file mode 100644 index 0000000..8e1ab13 --- /dev/null +++ b/ucs2-afb/ucs_apidef.h @@ -0,0 +1,86 @@ + +static const char _afb_description_v2_UNICENS[] = + "{\"openapi\":\"3.0.0\",\"$schema\":\"http:iot.bzh/download/openapi/schem" + "a-3.0/default-schema.json\",\"info\":{\"description\":\"\",\"title\":\"u" + "cs2\",\"version\":\"1.0\",\"x-binding-c-generator\":{\"api\":\"UNICENS\"" + ",\"version\":2,\"prefix\":\"Ucs2\",\"postfix\":\"API\",\"start\":null,\"" + "onevent\":null,\"init\":null,\"scope\":\"\",\"private\":false}},\"server" + "s\":[{\"url\":\"ws://{host}:{port}/api/monitor\",\"description\":\"Unice" + "ns2 API.\",\"variables\":{\"host\":{\"default\":\"localhost\"},\"port\":" + "{\"default\":\"1234\"}},\"x-afb-events\":[{\"$ref\":\"#/components/schem" + "as/afb-event\"}]}],\"components\":{\"schemas\":{\"afb-reply\":{\"$ref\":" + "\"#/components/schemas/afb-reply-v2\"},\"afb-event\":{\"$ref\":\"#/compo" + "nents/schemas/afb-event-v2\"},\"afb-reply-v2\":{\"title\":\"Generic resp" + "onse.\",\"type\":\"object\",\"required\":[\"jtype\",\"request\"],\"prope" + "rties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-reply\"},\"reque" + "st\":{\"type\":\"object\",\"required\":[\"status\"],\"properties\":{\"st" + "atus\":{\"type\":\"string\"},\"info\":{\"type\":\"string\"},\"token\":{\"" + "type\":\"string\"},\"uuid\":{\"type\":\"string\"},\"reqid\":{\"type\":\"" + "string\"}}},\"response\":{\"type\":\"object\"}}},\"afb-event-v2\":{\"typ" + "e\":\"object\",\"required\":[\"jtype\",\"event\"],\"properties\":{\"jtyp" + "e\":{\"type\":\"string\",\"const\":\"afb-event\"},\"event\":{\"type\":\"" + "string\"},\"data\":{\"type\":\"object\"}}}},\"x-permissions\":{\"config\"" + ":{\"permission\":\"urn:AGL:permission:UNICENS:public:initialise\"},\"mon" + "itor\":{\"permission\":\"urn:AGL:permission:UNICENS:public:monitor\"}},\"" + "responses\":{\"200\":{\"description\":\"A complex object array response\"" + ",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/" + "schemas/afb-reply\"}}}}}},\"paths\":{\"/initialise\":{\"description\":\"" + "Initialise Unicens2 lib from NetworkConfig.XML.\",\"get\":{\"x-permissio" + "ns\":{\"$ref\":\"#/components/x-permissions/config\"},\"parameters\":[{\"" + "in\":\"query\",\"name\":\"filename\",\"required\":true,\"schema\":{\"typ" + "e\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/respon" + "ses/200\"}}}},\"/volume\":{\"description\":\"Set Master Volume.\",\"get\"" + ":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions/monitor\"},\"" + "parameters\":[{\"in\":\"query\",\"name\":\"value\",\"required\":true,\"s" + "chema\":{\"type\":\"integer\"}}],\"responses\":{\"200\":{\"$ref\":\"#/co" + "mponents/responses/200\"}}}},\"/monitor\":{\"description\":\"Subscribe t" + "o Unicens Event.\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x" + "-permissions/monitor\"},\"responses\":{\"200\":{\"$ref\":\"#/components/" + "responses/200\"}}}}}}" +; + +static const struct afb_auth _afb_auths_v2_UNICENS[] = { + { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:initialise" }, + { .type = afb_auth_Permission, .text = "urn:AGL:permission:UNICENS:public:monitor" } +}; + + void Ucs2initialiseAPI(struct afb_req req); + void Ucs2volumeAPI(struct afb_req req); + void Ucs2monitorAPI(struct afb_req req); + +static const struct afb_verb_v2 _afb_verbs_v2_UNICENS[] = { + { + .verb = "initialise", + .callback = Ucs2initialiseAPI, + .auth = &_afb_auths_v2_UNICENS[0], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { + .verb = "volume", + .callback = Ucs2volumeAPI, + .auth = &_afb_auths_v2_UNICENS[1], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { + .verb = "monitor", + .callback = Ucs2monitorAPI, + .auth = &_afb_auths_v2_UNICENS[1], + .info = NULL, + .session = AFB_SESSION_NONE_V2 + }, + { .verb = NULL } +}; + +const struct afb_binding_v2 afbBindingV2 = { + .api = "UNICENS", + .specification = _afb_description_v2_UNICENS, + .info = NULL, + .verbs = _afb_verbs_v2_UNICENS, + .preinit = NULL, + .init = NULL, + .onevent = NULL, + .noconcurrency = 0 +}; + diff --git a/ucs2-afb/ucs_apidef.json b/ucs2-afb/ucs_apidef.json index 5aa33a2..9936004 100644 --- a/ucs2-afb/ucs_apidef.json +++ b/ucs2-afb/ucs_apidef.json @@ -1,6 +1,6 @@ { "openapi": "3.0.0", - "$schema": "file:///home/fulup/Workspace/AGL-AppFW/unicens2rc-afb/etc/openapi-schema.json", + "$schema": "http:iot.bzh/download/openapi/schema-3.0/default-schema.json", "info": { "description": "", "title": "ucs2", @@ -8,13 +8,13 @@ "x-binding-c-generator": { "api": "UNICENS", "version": 2, - "prefix": "ucs2_", - "postfix": "", + "prefix": "Ucs2", + "postfix": "API", "start": null , "onevent": null, "init": null, - "scope": "static", - "private": true + "scope": "", + "private": false } }, "servers": [ @@ -39,12 +39,12 @@ "components": { "schemas": { "afb-reply": { - "$ref": "#/components/schemas/afb-reply-v1" + "$ref": "#/components/schemas/afb-reply-v2" }, "afb-event": { - "$ref": "#/components/schemas/afb-event-v1" + "$ref": "#/components/schemas/afb-event-v2" }, - "afb-reply-v1": { + "afb-reply-v2": { "title": "Generic response.", "type": "object", "required": [ "jtype", "request" ], @@ -67,7 +67,7 @@ "response": { "type": "object" } } }, - "afb-event-v1": { + "afb-event-v2": { "type": "object", "required": [ "jtype", "event" ], "properties": { @@ -121,8 +121,27 @@ } } }, + "/volume": { + "description": "Set Master Volume.", + "get": { + "x-permissions": { + "$ref": "#/components/x-permissions/monitor" + }, + "parameters": [ + { + "in": "query", + "name": "value", + "required": true, + "schema": { "type": "integer" } + } + ], + "responses": { + "200": {"$ref": "#/components/responses/200"} + } + } + }, "/monitor": { - "description": "Subscribe to Unicens2 Events.", + "description": "Subscribe to Unicens Event.", "get": { "x-permissions": { "$ref": "#/components/x-permissions/monitor" diff --git a/ucs2-afb/ucs_apihat.c b/ucs2-afb/ucs_apihat.c new file mode 100644 index 0000000..04bf50f --- /dev/null +++ b/ucs2-afb/ucs_apihat.c @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2016 "IoT.bzh" + * Author Fulup Ar Foll + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include "ucs_binding.h" +#include "ucs_apidef.h" -- cgit 1.2.3-korg From 07b52f2a1a51a0715e03346229d72bb3c7154b2b Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 19 Jul 2017 15:35:39 +0200 Subject: First Compilation in V2 (work in Progress) --- nbproject/configurations.xml | 71 ++++++++++++++++++++++++++++++++------------ ucs2-afb/ucs_apihat.c | 2 ++ ucs2-afb/ucs_apihat.h | 48 ------------------------------ ucs2-afb/ucs_binding.c | 31 +++++++++++-------- ucs2-afb/ucs_binding.h | 6 ++-- 5 files changed, 77 insertions(+), 81 deletions(-) delete mode 100644 ucs2-afb/ucs_apihat.h diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 5d4dfd9..9bf2285 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -35,6 +35,7 @@ libmostvolume.cpp + ucs_apihat.c ucs_binding.c ucs_binding.new.c @@ -201,23 +202,12 @@ - - ../../../opt/include - /usr/include/json-c - ucs2-interface - ucs2-lib/inc - ucs2-lib/cfg - ucs2-lib/src/ucs-xml - ucs2-vol/inc - ucs2-vol/cfg - ucs2-vol/src/ucs-xml - build/ucs2-afb - CONTROL_CDEV_RX="/dev/inic-usb-crx" CONTROL_CDEV_TX="/dev/inic-usb-ctx" _REENTRANT _THREAD_SAFE + ucs2_afb_EXPORTS @@ -282,21 +272,55 @@ + + + + /usr/include/json-c + ../../../opt/include + /usr/include/p11-kit-1 + ucs2-interface + ucs2-lib/unicens/inc + ucs2-lib/cfg_agl + ucs2-vol/inc + ucs2-vol/cfg + ucs2-vol/src/ucs-xml + build/ucs2-afb + + + - - ucs2_EXPORTS - + + /usr/include/json-c + ../../../opt/include + /usr/include/p11-kit-1 + ucs2-interface + ucs2-lib/unicens/inc + ucs2-lib/cfg_agl + ucs2-vol/inc + ucs2-vol/cfg + ucs2-vol/src/ucs-xml + build/ucs2-afb + - - ucs2_afb_EXPORTS - + + ../../../opt/include + /usr/include/json-c + ucs2-interface + ucs2-lib/inc + ucs2-lib/cfg + ucs2-lib/src/ucs-xml + ucs2-vol/inc + ucs2-vol/cfg + ucs2-vol/src/ucs-xml + build/ucs2-afb + - + @@ -667,6 +691,15 @@ + + + + ucs2-afb + ../../../opt/include/afb + build/ucs2-afb + + + diff --git a/ucs2-afb/ucs_apihat.c b/ucs2-afb/ucs_apihat.c index 04bf50f..9a6abd9 100644 --- a/ucs2-afb/ucs_apihat.c +++ b/ucs2-afb/ucs_apihat.c @@ -18,4 +18,6 @@ #define _GNU_SOURCE #include "ucs_binding.h" + +// include code generated from afb-genskel #include "ucs_apidef.h" diff --git a/ucs2-afb/ucs_apihat.h b/ucs2-afb/ucs_apihat.h deleted file mode 100644 index 8926344..0000000 --- a/ucs2-afb/ucs_apihat.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * AlsaLibMapping -- provide low level interface with AUDIO lib (extracted from alsa-json-gateway code) - * Copyright (C) 2015,2016,2017, Fulup Ar Foll fulup@iot.bzh - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef UCS2BINDING_H -#define UCS2BINDING_H - -#ifndef PUBLIC - #define PUBLIC -#endif -#define STATIC static - -#include -#include -#include - -#include "ucs_interface.h" - -#ifndef CONTROL_CDEV_TX -#error FATAL: CONTROL_CDEV_TX missing (check ./etc/config.cmake + rerun cmake) -#endif -#ifndef CONTROL_CDEV_RX -#error FATAL: CONTROL_CDEV_RX missing (check ./etc/config.cmake + rerun cmake) -#endif - -// import from AlsaAfbBinding -extern const struct afb_binding_interface *afbIface; -extern struct afb_service afbSrv; - -// API verbs prototype -PUBLIC void initUcs2 (struct afb_req request); - - -#endif /* UCS2BINDING_H */ - diff --git a/ucs2-afb/ucs_binding.c b/ucs2-afb/ucs_binding.c index fc8d613..8ccc02f 100644 --- a/ucs2-afb/ucs_binding.c +++ b/ucs2-afb/ucs_binding.c @@ -65,11 +65,18 @@ typedef struct { static ucsContextT *ucsContextS; PUBLIC void UcsXml_CB_OnError(const char format[], uint16_t vargsCnt, ...) { - /*DEBUG (afbIface, format, args); */ + /*AFB_DEBUG (afbIface, format, args); */ va_list args; va_start (args, vargsCnt); vfprintf (stderr, format, args); va_end(args); + + va_list argptr; + char outbuf[300]; + va_start(argptr, vargsCnt); + vsprintf(outbuf, format, argptr); + va_end(argptr); + AFB_WARNING (outbuf); } PUBLIC uint16_t UCSI_CB_OnGetTime(void *pTag) { @@ -99,8 +106,8 @@ STATIC int onTimerCB (sd_event_source* source,uint64_t timer, void* pTag) { PUBLIC void UCSI_CB_OnSetServiceTimer(void *pTag, uint16_t timeout) { uint64_t usec; /* set a timer with 250ms accuracy */ - sd_event_now(afb_daemon_get_event_loop(afbIface->daemon), CLOCK_BOOTTIME, &usec); - sd_event_add_time(afb_daemon_get_event_loop(afbIface->daemon), NULL, CLOCK_MONOTONIC, usec + (timeout*1000), 250, onTimerCB, pTag); + sd_event_now(afb_daemon_get_event_loop(), CLOCK_BOOTTIME, &usec); + sd_event_add_time(afb_daemon_get_event_loop(), NULL, CLOCK_MONOTONIC, usec + (timeout*1000), 250, onTimerCB, pTag); } @@ -121,7 +128,7 @@ void UCSI_CB_OnUserMessage(void *pTag, bool isError, const char format[], vsprintf(outbuf, format, argptr); va_end(argptr); if (isError) - NOTICE (afbIface, outbuf); + AFB_NOTICE (outbuf); } /** UCSI_Service cannot be called directly within UNICENS context, need to service stack through mainloop */ @@ -137,7 +144,7 @@ STATIC int OnServiceRequiredCB (sd_event_source *source, uint64_t usec, void *pT PUBLIC void UCSI_CB_OnServiceRequired(void *pTag) { /* push an asynchronous request for loopback to call UCSI_Service */ - sd_event_add_time(afb_daemon_get_event_loop(afbIface->daemon), NULL, CLOCK_MONOTONIC, 0, 0, OnServiceRequiredCB, pTag); + sd_event_add_time(afb_daemon_get_event_loop(), NULL, CLOCK_MONOTONIC, 0, 0, OnServiceRequiredCB, pTag); } /* Callback when ever this UNICENS wants to send a message to INIC. */ @@ -173,7 +180,7 @@ PUBLIC void UCSI_CB_OnTxRequest(void *pTag, const uint8_t *pData, uint32_t len) * \param pTag - Pointer given by the integrator by UCSI_Init */ void UCSI_CB_OnStop(void *pTag) { - NOTICE (afbIface, "UNICENS stopped"); + AFB_NOTICE ("UNICENS stopped"); } @@ -231,7 +238,7 @@ int onReadCB (sd_event_source* src, int fileFd, uint32_t revents, void* pTag) { return 0; ok= UCSI_ProcessRxData(&ucsContext->ucsiData, pBuffer, (uint16_t)len); if (!ok) { - DEBUG (afbIface, "Buffer overrun (not handle)"); + AFB_DEBUG ("Buffer overrun (not handle)"); /* Buffer overrun could replay pBuffer */ } return 0; @@ -264,7 +271,7 @@ STATIC UcsXmlVal_t* ParseFile(struct afb_req request) { xmlBuffer[readSize] = '\0'; /* In any case, terminate it. */ if (readSize != fdStat.st_size) { - afb_req_fail_f (request, "fileread-fail", "File to read fullfile '%s' size(%d!=%d)", filename, readSize, fdStat.st_size); + afb_req_fail_f (request, "fileread-fail", "File to read fullfile '%s' size(%d!=%d)", filename, (int)readSize, (int)fdStat.st_size); goto OnErrorExit; } @@ -292,8 +299,8 @@ STATIC int volOnSvcCB (sd_event_source* source,uint64_t timer, void* pTag) { /* This callback is fire each time an volume event wait in the queue */ void volumeCB (uint16_t timeout) { uint64_t usec; - sd_event_now(afb_daemon_get_event_loop(afbIface->daemon), CLOCK_BOOTTIME, &usec); - sd_event_add_time(afb_daemon_get_event_loop(afbIface->daemon), NULL, CLOCK_MONOTONIC, usec + (timeout*1000), 250, volOnSvcCB, ucsContextS); + sd_event_now(afb_daemon_get_event_loop(), CLOCK_BOOTTIME, &usec); + sd_event_add_time(afb_daemon_get_event_loop(), NULL, CLOCK_MONOTONIC, usec + (timeout*1000), 250, volOnSvcCB, ucsContextS); } STATIC int volSndCmd (struct afb_req request, struct json_object *commandJ, ucsContextT *ucsContext) { @@ -416,7 +423,7 @@ PUBLIC void ucs2SetVol (struct afb_req request) { } -PUBLIC void ucs2Init (struct afb_req request) { +PUBLIC void ucs2Configure (struct afb_req request) { static UcsXmlVal_t *ucsConfig; static ucsContextT ucsContext; @@ -439,7 +446,7 @@ PUBLIC void ucs2Init (struct afb_req request) { UCSI_Init(&ucsContext.ucsiData, &ucsContext); /* register aplayHandle file fd into binder mainloop */ - err = sd_event_add_io(afb_daemon_get_event_loop(afbIface->daemon), &evtSource, ucsContext.rx.fileHandle, EPOLLIN, onReadCB, &ucsContext); + err = sd_event_add_io(afb_daemon_get_event_loop(), &evtSource, ucsContext.rx.fileHandle, EPOLLIN, onReadCB, &ucsContext); if (err < 0) { afb_req_fail_f (request, "register-mainloop", "Cannot hook events to mainloop"); goto OnErrorExit; diff --git a/ucs2-afb/ucs_binding.h b/ucs2-afb/ucs_binding.h index 5b74730..082f6cc 100644 --- a/ucs2-afb/ucs_binding.h +++ b/ucs2-afb/ucs_binding.h @@ -18,6 +18,9 @@ #ifndef UCS2BINDING_H #define UCS2BINDING_H +// Use Version of AGL Application Framework API +#define AFB_BINDING_VERSION 2 + #ifndef PUBLIC #define PUBLIC #endif @@ -25,7 +28,6 @@ #include #include -#include #include "ucs_interface.h" @@ -41,7 +43,7 @@ extern const struct afb_binding_interface *afbIface; extern struct afb_service afbSrv; // API verbs prototype -PUBLIC void ucs2Init (struct afb_req request); +PUBLIC void ucs2Configure (struct afb_req request); PUBLIC void ucs2SetVol (struct afb_req request); -- cgit 1.2.3-korg From 359083b3a1852e0993dd657d74354955ef25ee44 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 19 Jul 2017 21:52:53 +0200 Subject: Added XML schema check at build time --- data/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index d49221d..7963474 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -23,18 +23,22 @@ ################################################## PROJECT_TARGET_ADD(ucs2_config) - file(GLOB SOURCE_FILES "*.xml") + file(GLOB XML_FILES "*.xml") + set(XML_SCHEMA unicens.xsd) add_custom_target(${TARGET_NAME} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} ) + # check XML schema before pushing config add_custom_command( - DEPENDS ${SOURCE_FILES} + DEPENDS ${XML_FILES} OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} + COMMAND cp -r ${XML_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} ) SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES -- cgit 1.2.3-korg From 01a3f74a836d769f7af9bb2dc4fa631b07b881fb Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Thu, 20 Jul 2017 22:10:58 +0200 Subject: Initial API-V2 ajusted HTML page to fit new commands names --- htdocs/UNICENS.html | 12 ++++----- ucs2-afb/ucs_apidef.h | 66 ++++++++++++++++++++++++------------------------ ucs2-afb/ucs_apidef.json | 8 +++--- ucs2-afb/ucs_binding.c | 9 +++++-- ucs2-afb/ucs_binding.h | 5 ++-- 5 files changed, 53 insertions(+), 47 deletions(-) diff --git a/htdocs/UNICENS.html b/htdocs/UNICENS.html index 04ad916..fe25fe1 100644 --- a/htdocs/UNICENS.html +++ b/htdocs/UNICENS.html @@ -11,12 +11,12 @@
    -
  1. -
  2. -
  3. -
  4. -
  5. -
  6. +
  7. +
  8. +
  9. +
  10. +
  11. +