- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# osc.h

    00001 /*********************************************************************************
    00002
    00003  Copyright 2006-2008 MakingThings
    00004
    00005  Licensed under the Apache License,
    00006  Version 2.0 (the "License"); you may not use this file except in compliance
    00007  with the License. You may obtain a copy of the License at
    00008
    00009  http://www.apache.org/licenses/LICENSE-2.0
    00010
    00011  Unless required by applicable law or agreed to in writing, software distributed
    00012  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    00013  CONDITIONS OF ANY KIND, either express or implied. See the License for
    00014  the specific language governing permissions and limitations under the License.
    00015
    00016 *********************************************************************************/
    00017
    00018 /*
    00019   osc.h
    00020 */
    00021
    00022 #include "types.h"
    00023
    00024 #ifndef OSC_H
    00025 #define OSC_H
    00026
    00027 #define OSC_SUBSYSTEM_COUNT  18
    00028
    00029 #define OSC_SCRATCH_SIZE    100
    00030
    00031 #define OSC_CHANNEL_COUNT    3
    00032 #define OSC_CHANNEL_UDP 0
    00033 #define OSC_CHANNEL_USB 1
    00034 #define OSC_CHANNEL_TCP 2
    00035
    00036 // Top level functions
    00037 void Osc_SetActive( int state, bool udptask, bool usbtask, bool async );
    00038 int Osc_GetActive( void );
    00039 int Osc_GetRunning( void );
    00040
    00041 int Osc_CreateMessage( int channel, char* address, char* format, ... );
    00042 int Osc_CreateMessageToBuf( char* bp, int* length, char* address, char* format, ... );
    00043 int Osc_SendPacket( int channel );
    00044
    00045 int Osc_RegisterSubsystem( const char *name,
    00046                            int (*Subsystem_ReceiveMessage)( int channel, char* buffer, int length ),
    00047                            int (*Subsystem_Poll)( int channel ) );
    00048
    00049 // Helpers for processing messages - they return error codes as spec'ed above
    00050 int Osc_IntReceiverHelper( int channel, char* message, int length,
    00051                            char* subsystemName,
    00052                            int (*propertySet)( int property, int value ),
    00053                            int (*propertyGet)( int property ),
    00054                            char* propertyNames[] );
    00055
    00056 int Osc_IndexIntReceiverHelper( int channel, char* message, int length,
    00057                                 int indexCount, char* subsystemName,
    00058                                 int (*propertySet)( int index, int property, int value ),
    00059                                 int (*propertyGet)( int index, int property ),
    00060                                 char* propertyNames[] );
    00061
    00062 int Osc_BlobReceiverHelper( int channel, char* message, int length,
    00063                             char* subsystemName,
    00064                             int (*blobPropertySet)( int property, uchar* buffer, int length ),
    00065                             int (*blobPropertyGet)( int property, uchar* buffer, int size ),
    00066                             char* blobPropertyNames[] );
    00067
    00068
    00069 int Osc_IndexBlobReceiverHelper( int channel, char* message, int length,
    00070                                  int indexCount, char* subsystemName,
    00071                                  int (*blobPropertySet)( int index, int property, uchar* buffer, int length ),
    00072                                  int (*blobPropertyGet)( int index, int property, uchar* buffer, int size ),
    00073                                  char* blobPropertyNames[] );
    00074
    00075 int Osc_GeneralReceiverHelper( int channel, char* message, int length,
    00076                            char* subsystemName,
    00077                            int (*propertySet)( int property, char* typedata, int channel ),
    00078                            int (*propertyGet)( int property, int channel ),
    00079                            char* propertyNames[] );
    00080
    00081 int Osc_SendError( int channel, char* subsystemName, int error );
    00082
    00083
    00084 // Functions needed to process messages
    00085 int Osc_SubsystemError( int channel, char* subsystem, char* string );
    00086 int Osc_PropertyLookup( char** properties, char* property );
    00087 char *Osc_FindDataTag( char* message, int length );
    00088 int Osc_ExtractData( char* buffer, char* format, ... );
    00089 int Osc_NumberMatch( int max, char* pattern, int* fancy );
    00090 int Osc_SetReplyAddress( int channel, int replyAddress );
    00091 int Osc_SetReplyPort( int channel, int replyPort );
    00092
    00093 // Pattern Match Stuff
    00094 bool Osc_PatternMatch(const char *  pattern, const char * test);
    00095 void Osc_TcpTask( void *p );
    00096 void Osc_StartTcpTask( void );
    00097
    00098 #endif

The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.