This commit is contained in:
workinghard
2015-04-13 23:59:32 -07:00
parent 9747076ebb
commit b9d4bf0ca7
8 changed files with 298 additions and 24 deletions

View File

@@ -60,10 +60,24 @@ class Animations: NSObject {
return _animationArray.count return _animationArray.count
} }
func loadAnimations(animArray: NSArray) {
// clear the array first
_animationArray.removeAll(keepCapacity: true)
for ( var i=0; i<animArray.count; i++ ) {
_animationArray.append(animArray[i] as! NSMutableDictionary)
//println("append Animation count: \(_animationArray.count)")
}
_gameView.resetView()
__tableView.reloadData()
}
func getAnimation(id: Int) -> (NSDictionary) { func getAnimation(id: Int) -> (NSDictionary) {
let myAnimation = _animationArray[id] as NSDictionary let myAnimation = _animationArray[id] as NSDictionary
return myAnimation return myAnimation
} }
func getAnimations() -> ([NSDictionary]) {
return _animationArray as [NSDictionary];
}
func getAnimationName(id: Int) -> (String) { func getAnimationName(id: Int) -> (String) {
let value = (self.getAnimation(id)).objectForKey(AnimName) as! String let value = (self.getAnimation(id)).objectForKey(AnimName) as! String

View File

@@ -23,11 +23,17 @@ var dataArray: [NSMutableDictionary] = [["AnimName": "Animation1", "AnimKey": "1
//var _animationArray: [NSMutableDictionary] = [NSMutableDictionary](); //var _animationArray: [NSMutableDictionary] = [NSMutableDictionary]();
//var _selectedAnimation: Int = 0; //var _selectedAnimation: Int = 0;
var __tableView: NSTableView = NSTableView()
class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate { class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate {
@IBOutlet weak var myTableView: NSTableView! @IBOutlet weak var myTableView: NSTableView!
override func awakeFromNib() {
super.awakeFromNib()
__tableView = myTableView
}
func numberOfRowsInTableView(tableView: NSTableView) -> Int { func numberOfRowsInTableView(tableView: NSTableView) -> Int {
let numberOfRows:Int = __animations.count() // _animationArray.count let numberOfRows:Int = __animations.count() // _animationArray.count
return numberOfRows return numberOfRows
@@ -136,6 +142,40 @@ class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate
} }
} }
func convertInt16(value: UInt16) -> ([UInt8]) {
var array: [UInt8] = [0,0]
array[0] = UInt8(value & 0x000000ff);
array[1] = UInt8((value & 0x0000ff00) >> 8);
return array;
}
func convertInt32(value: UInt32) -> ([UInt8]) {
var array: [UInt8] = [0,0,0,0]
array[0] = UInt8(value & 0x000000ff);
array[1] = UInt8((value & 0x0000ff00) >> 8);
array[2] = UInt8((value & 0x00ff0000) >> 16);
array[3] = UInt8((value & 0xff000000) >> 24);
return array;
}
@IBAction func exportAnimations(send: AnyObject) {
let testdata: [UInt8] = [254, 1, 128, 255]
println("Import button pressed")
// for each animation
// Create header line per animation
// Append frame, separated by new-Line
// Calculate overall data to send
// Send data
CubeNetworkObj.sendBytes(testdata, count: UInt32(testdata.count))
}
/* /*
@IBAction func closeButtonClicked(sender: AnyObject ) { @IBAction func closeButtonClicked(sender: AnyObject ) {
animationsWindow.close() animationsWindow.close()

View File

@@ -17,6 +17,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow! @IBOutlet weak var window: NSWindow!
@IBOutlet weak var animationsWindow: NSWindow! @IBOutlet weak var animationsWindow: NSWindow!
@IBOutlet weak var preferencesWindow: NSWindow!
@IBOutlet weak var myMenu: NSMenu!
func applicationDidFinishLaunching(aNotification: NSNotification) { func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application // Insert code here to initialize your application
@@ -30,5 +33,41 @@ class AppDelegate: NSObject, NSApplicationDelegate {
return NSApplicationTerminateReply.TerminateNow return NSApplicationTerminateReply.TerminateNow
} }
@IBAction func saveDocument(sender: AnyObject) {
let mySavePanel: NSSavePanel = NSSavePanel()
mySavePanel.allowedFileTypes = ["plist"]
mySavePanel.beginWithCompletionHandler { (result: Int) -> Void in
if result == NSFileHandlingPanelOKButton {
let exportedFileURL = mySavePanel.URL
// Save the data. What you do depends on your app.
let myAnimArray: NSMutableArray = NSMutableArray()
myAnimArray.addObjectsFromArray(__animations.getAnimations())
myAnimArray.writeToURL(exportedFileURL!, atomically: true)
//let myAnimation: NSDictionary = NSDictionary(dictionary: __animations.getAnimations())
// Don't just paste this code in your app as your app
// probably doesn't have a createPDF() method. self.createPDF(exportedFileURL)
}
} // End block
println("save pressed")
}
@IBAction func openDocument(sender: AnyObject) {
let myOpenPanel: NSOpenPanel = NSOpenPanel()
myOpenPanel.allowedFileTypes = ["plist"]
myOpenPanel.beginWithCompletionHandler { (result: Int) -> Void in
if result == NSFileHandlingPanelOKButton {
let importedFileURL = myOpenPanel.URL
//let myAnimationsDict: NSMutableDictionary = NSMutableDictionary(contentsOfURL: importedFileURL!)!
let myAnimArray: NSMutableArray = NSMutableArray(contentsOfURL: importedFileURL!)!
__animations.loadAnimations(myAnimArray)
}
} // End block
}
@IBAction func openPreferences(send: AnyObject) {
preferencesWindow.setIsVisible(true)
}
} }

View File

@@ -14,10 +14,10 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29"> <menu title="AMainMenu" systemMenu="main" id="29">
<items> <items>
<menuItem title="SceneKit Mac Template" id="56"> <menuItem title="Cube4Fun" id="56">
<menu key="submenu" title="SceneKit Mac Template" systemMenu="apple" id="57"> <menu key="submenu" title="Cube4Fun" systemMenu="apple" id="57">
<items> <items>
<menuItem title="About SceneKit Mac Template" id="58"> <menuItem title="About Cube4Fun" id="58">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/> <action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
@@ -26,7 +26,11 @@
<menuItem isSeparatorItem="YES" id="236"> <menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/> <modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem> </menuItem>
<menuItem title="Preferences…" keyEquivalent="," id="129"/> <menuItem title="Preferences…" keyEquivalent="," id="129">
<connections>
<action selector="openPreferences:" target="494" id="YdV-xj-oBb"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="143"> <menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/> <modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem> </menuItem>
@@ -76,10 +80,10 @@
<action selector="openDocument:" target="-1" id="374"/> <action selector="openDocument:" target="-1" id="374"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Open Recent" id="124"> <menuItem title="Open Recent" hidden="YES" enabled="NO" id="124">
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125"> <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125">
<items> <items>
<menuItem title="Clear Menu" id="126"> <menuItem title="Clear Menu" enabled="NO" id="126">
<connections> <connections>
<action selector="clearRecentDocuments:" target="-1" id="127"/> <action selector="clearRecentDocuments:" target="-1" id="127"/>
</connections> </connections>
@@ -100,22 +104,22 @@
<action selector="saveDocument:" target="-1" id="362"/> <action selector="saveDocument:" target="-1" id="362"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Revert to Saved" id="112"> <menuItem title="Revert to Saved" hidden="YES" enabled="NO" id="112">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="revertDocumentToSaved:" target="-1" id="364"/> <action selector="revertDocumentToSaved:" target="-1" id="364"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="74"> <menuItem isSeparatorItem="YES" hidden="YES" id="74">
<modifierMask key="keyEquivalentModifierMask" command="YES"/> <modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem> </menuItem>
<menuItem title="Page Setup..." keyEquivalent="P" id="77"> <menuItem title="Page Setup..." hidden="YES" enabled="NO" keyEquivalent="P" id="77">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/> <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections> <connections>
<action selector="runPageLayout:" target="-1" id="87"/> <action selector="runPageLayout:" target="-1" id="87"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Print…" keyEquivalent="p" id="78"> <menuItem title="Print…" hidden="YES" enabled="NO" keyEquivalent="p" id="78">
<connections> <connections>
<action selector="print:" target="-1" id="86"/> <action selector="print:" target="-1" id="86"/>
</connections> </connections>
@@ -803,6 +807,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
<connections>
<action selector="exportAnimations:" target="zTF-MA-6NT" id="Wqf-T8-ibb"/>
</connections>
</button> </button>
<button verticalHuggingPriority="750" id="5ce-Cy-Wpt"> <button verticalHuggingPriority="750" id="5ce-Cy-Wpt">
<rect key="frame" x="220" y="13" width="58" height="32"/> <rect key="frame" x="220" y="13" width="58" height="32"/>
@@ -847,6 +854,8 @@
<customObject id="494" customClass="AppDelegate" customModule="Cube4Fun" customModuleProvider="target"> <customObject id="494" customClass="AppDelegate" customModule="Cube4Fun" customModuleProvider="target">
<connections> <connections>
<outlet property="animationsWindow" destination="P9J-nG-QID" id="T26-Ji-oQm"/> <outlet property="animationsWindow" destination="P9J-nG-QID" id="T26-Ji-oQm"/>
<outlet property="myMenu" destination="29" id="4VP-Ge-aQq"/>
<outlet property="preferencesWindow" destination="rBP-b5-IAd" id="ALx-FA-6L2"/>
<outlet property="window" destination="371" id="532"/> <outlet property="window" destination="371" id="532"/>
</connections> </connections>
</customObject> </customObject>
@@ -862,5 +871,86 @@
<outlet property="myTableView" destination="iWG-Dg-mvn" id="KUj-8f-taa"/> <outlet property="myTableView" destination="iWG-Dg-mvn" id="KUj-8f-taa"/>
</connections> </connections>
</customObject> </customObject>
<window identifier="Preferences" title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="rBP-b5-IAd">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="131" y="158" width="393" height="181"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" id="lCF-PB-zvB">
<rect key="frame" x="0.0" y="0.0" width="393" height="181"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<box autoresizesSubviews="NO" title="Cube Connection" borderType="line" id="j0p-9o-m4u">
<rect key="frame" x="17" y="16" width="359" height="145"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView">
<rect key="frame" x="1" y="1" width="357" height="129"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" id="P2I-nN-SoZ">
<rect key="frame" x="97" y="90" width="130" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="a7v-ph-2VN">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="2zp-D1-Brz">
<rect key="frame" x="16" y="93" width="75" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="IP Address:" id="QYT-Fg-a2I">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Fif-B2-ngg">
<rect key="frame" x="245" y="93" width="34" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Port:" id="8GK-Wg-2Dg">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" id="rTg-FP-cJJ">
<rect key="frame" x="91" y="49" width="244" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Test" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="swa-BG-Tr6">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<levelIndicator verticalHuggingPriority="750" id="XB5-E8-zg1">
<rect key="frame" x="18" y="12" width="321" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<levelIndicatorCell key="cell" alignment="left" maxValue="1" criticalValue="1" id="u4h-Q5-xzG"/>
</levelIndicator>
<progressIndicator hidden="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" id="H64-jS-YOR">
<rect key="frame" x="45" y="58" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</progressIndicator>
<textField verticalHuggingPriority="750" id="x0K-yJ-HcE">
<rect key="frame" x="280" y="90" width="49" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="oeh-4x-nt8">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="494" id="MZz-Cx-z5T"/>
</connections>
<point key="canvasLocation" x="278.5" y="412.5"/>
</window>
</objects> </objects>
</document> </document>

View File

@@ -34,6 +34,7 @@ int i,x;
unsigned char color; unsigned char color;
DialogSocket ds; DialogSocket ds;
int frameChange = 0; int frameChange = 0;
int streamMode = 0; // 0 = off, 1 = frameStream, 2 = writeStream
void sleepcp(int milliseconds) // cross-platform sleep function void sleepcp(int milliseconds) // cross-platform sleep function
{ {
@@ -93,8 +94,25 @@ bool frame1[3][64] = { {1,0,0,1,
1,0,0,1, 1,0,0,1,
0,0,0,0}}; 0,0,0,0}};
void byte2uint32(unsigned char* bytes, u_int32_t msgLength) {
unsigned char *vp = (unsigned char *)&msgLength;
bytes[0] = vp[0]; // int32 to byte array conversion
bytes[1] = vp[1];
bytes[2] = vp[2];
bytes[3] = vp[3];
}
void fillBufferWithMsg() { void msgCloseFrameStream() {
try {
buffer3D[0] = 's';
buffer3D[1] = 'S';
ds.sendBytes(buffer3D, 2); // End the stream mode
}catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl;
}
}
void fillBufferWithMsgStartStream() {
buffer3D[0] = 'G'; buffer3D[0] = 'G';
buffer3D[1] = 'E'; buffer3D[1] = 'E';
buffer3D[2] = 'T'; buffer3D[2] = 'T';
@@ -104,9 +122,40 @@ void fillBufferWithMsg() {
buffer3D[6] = 'S'; buffer3D[6] = 'S';
buffer3D[7] = 's'; buffer3D[7] = 's';
buffer3D[8] = ' '; buffer3D[8] = ' ';
} }
void msgOpenFrameStream() {
fillBufferWithMsgStartStream();
ds.sendBytes(buffer3D, 9);
}
void msgStartWrite(u_int32_t msgLength) {
unsigned char myBuffer[4];
byte2uint32(myBuffer, msgLength);
try{
buffer3D[0] = 'G';
buffer3D[1] = 'E';
buffer3D[2] = 'T';
buffer3D[3] = ' ';
buffer3D[4] = '/';
buffer3D[5] = '?';
buffer3D[6] = 'W';
buffer3D[7] = 'w';
buffer3D[8] = myBuffer[0]; // int32 to byte array conversion
buffer3D[9] = myBuffer[1];
buffer3D[10] = myBuffer[2];
buffer3D[11] = myBuffer[3];
buffer3D[12] = ' ';
ds.sendBytes(buffer3D, 13);
}catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl;
}
}
void testFrame() { void testFrame() {
// for (color=128;color<130;color++) { // for (color=128;color<130;color++) {
// Create testframe // Create testframe
@@ -181,6 +230,42 @@ void CubeNetwork::updateFrame() {
} }
*/ */
void CubeNetwork::sendBytes(const unsigned char* byteBuffer, unsigned int byteLength) {
printf("sendBytes called\n");
if ( streamMode == 1 ) {
// End the frameStreammode first
msgCloseFrameStream();
streamMode = 2;
}
if ( byteBuffer != NULL ) {
try {
printf("Open connection for writing\n");
//ds.connect(SocketAddress("192.168.1.79", 8081));
// let arduino knows what to expect
msgStartWrite(byteLength);
unsigned char myBuffer[4];
int ret = ds.receiveRawBytes(myBuffer, 4);
printf("0: %u\n", myBuffer[0]);
printf("1: %u\n", myBuffer[1]);
printf("2: %u\n", myBuffer[2]);
printf("3: %u\n", myBuffer[3]);
printf("ret: %u\n", ret);
// send bytes to write
ds.sendBytes(byteBuffer, byteLength);
//ds.close();
// Reset to the frameStream mode
if ( streamMode == 2 ) {
msgOpenFrameStream();
streamMode = 1;
}
}catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl;
}
}
}
void CubeNetwork::updateFrame(const unsigned char * frameSequence, unsigned int frameCount) { void CubeNetwork::updateFrame(const unsigned char * frameSequence, unsigned int frameCount) {
// check for empty pointer // check for empty pointer
if ( frameSequence != NULL ) { if ( frameSequence != NULL ) {
@@ -197,10 +282,10 @@ void CubeNetwork::updateFrame(const unsigned char * frameSequence, unsigned int
void CubeNetwork::openConnection() { void CubeNetwork::openConnection() {
try { try {
printf("Try open the connection\n"); printf("Try to open the connection\n");
ds.connect(SocketAddress("192.168.1.79", 8081)); ds.connect(SocketAddress("192.168.1.79", 8081));
fillBufferWithMsg(); msgOpenFrameStream();
ds.sendBytes(buffer3D, 9); streamMode = 1;
}catch (const Poco::Net::NetException & e){ }catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl; std::cerr << e.displayText() << std::endl;
} }
@@ -208,38 +293,38 @@ void CubeNetwork::openConnection() {
void CubeNetwork::closeConnection() { void CubeNetwork::closeConnection() {
try { try {
buffer3D[0] = 's'; msgCloseFrameStream();
buffer3D[1] = 'S'; ds.close();
ds.sendBytes(buffer3D, 2); // End the stream mode
}catch (const Poco::Net::NetException & e){ }catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl; std::cerr << e.displayText() << std::endl;
} }
streamMode = 0;
} }
void CubeNetwork::initObjects() { void CubeNetwork::initObjects() {
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));
try { try {
ds.connect(SocketAddress("192.168.1.79", 8081)); ds.connect(SocketAddress("192.168.1.79", 8081));
fillBufferWithMsg(); fillBufferWithMsgStartStream();
ds.sendBytes(buffer3D, 9); ds.sendBytes(buffer3D, 9);
//testStream2(); //testStream2();
testFrame(); testFrame();
buffer3D[0] = 's'; msgCloseFrameStream();
buffer3D[1] = 'S';
ds.sendBytes(buffer3D, 2); // End the stream mode
}catch (const Poco::Net::NetException & e){ }catch (const Poco::Net::NetException & e){
std::cerr << e.displayText() << std::endl; std::cerr << e.displayText() << std::endl;
} }
std::cout << "It works" << std::endl; //std::cout << "It works" << std::endl;
} }
//void Performance_CPlusPlus::sortArray(unsigned int num_elements) //void Performance_CPlusPlus::sortArray(unsigned int num_elements)

View File

@@ -15,6 +15,7 @@ public:
static void initObjects(); static void initObjects();
static void updateFrame(const unsigned char * frameSequence = NULL, unsigned int frameCount = 0); static void updateFrame(const unsigned char * frameSequence = NULL, unsigned int frameCount = 0);
static void sendBytes(const unsigned char* byteBuffer = NULL, u_int32_t byteLength=0);
static void openConnection(); static void openConnection();
static void closeConnection(); static void closeConnection();

View File

@@ -10,6 +10,7 @@
@interface CubeNetworkObj : NSObject @interface CubeNetworkObj : NSObject
+ (void) updateFrame: (const unsigned char *) frameSequence count: (UInt32) frameCount; + (void) updateFrame: (const unsigned char *) frameSequence count: (UInt32) frameCount;
+ (void) sendBytes: (const unsigned char *) byteBuffer count: (u_int32_t) byteLength;
+ (void) initObjects; + (void) initObjects;
+ (void) openConnection; + (void) openConnection;
+ (void) closeConnection; + (void) closeConnection;

View File

@@ -13,6 +13,10 @@
{ {
CubeNetwork::updateFrame(frameSequence, frameCount); CubeNetwork::updateFrame(frameSequence, frameCount);
} }
+ (void) sendBytes: (const unsigned char *) byteBuffer count: (u_int32_t) byteLength
{
CubeNetwork::sendBytes(byteBuffer, byteLength);
}
+ (void) openConnection + (void) openConnection
{ {
CubeNetwork::openConnection(); CubeNetwork::openConnection();