This commit is contained in:
Milanka Ringwald 2015-07-16 10:27:07 +02:00
commit b1d931f9ca
14 changed files with 281 additions and 727 deletions

1
platforms/ios/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.deb

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>logo.png</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
</dict>
</plist>

View File

@ -1,275 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
9C04BB16107E9AD8002A63D0 /* BTDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C04BB12107E9AD8002A63D0 /* BTDevice.m */; };
9C04BBFF10824CDD002A63D0 /* libBTstack.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C04BBFE10824CDD002A63D0 /* libBTstack.dylib */; };
9C9AB4F412525E65008B4D52 /* BTDiscoveryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C9AB4F112525E65008B4D52 /* BTDiscoveryViewController.m */; };
9C9AB4F512525E65008B4D52 /* BTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C9AB4F212525E65008B4D52 /* BTstackManager.m */; };
9C9AB4F612525E65008B4D52 /* TestBTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C9AB4F312525E65008B4D52 /* TestBTstackManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* BTstackCocoa.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BTstackCocoa.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
32CA4F630368D1EE00C91783 /* BTstackCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTstackCocoa_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* BTstackCocoa-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "BTstackCocoa-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
9C04BB12107E9AD8002A63D0 /* BTDevice.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTDevice.m; path = src/BTDevice.m; sourceTree = "<group>"; };
9C04BB19107E9AEF002A63D0 /* BTDevice.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTDevice.h; path = include/BTstack/BTDevice.h; sourceTree = "<group>"; };
9C04BBFE10824CDD002A63D0 /* libBTstack.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libBTstack.dylib; path = ../src/libBTstack.dylib; sourceTree = SOURCE_ROOT; };
9C5E109512DE4FD80013EF2C /* BTDiscoveryViewController.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTDiscoveryViewController.h; path = include/BTstack/BTDiscoveryViewController.h; sourceTree = "<group>"; };
9C5E109612DE4FD80013EF2C /* BTstackManager.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTstackManager.h; path = include/BTstack/BTstackManager.h; sourceTree = "<group>"; };
9C9AB4F112525E65008B4D52 /* BTDiscoveryViewController.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTDiscoveryViewController.m; path = src/BTDiscoveryViewController.m; sourceTree = "<group>"; };
9C9AB4F212525E65008B4D52 /* BTstackManager.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTstackManager.m; path = src/BTstackManager.m; sourceTree = "<group>"; };
9C9AB4F312525E65008B4D52 /* TestBTstackManager.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = TestBTstackManager.m; path = src/TestBTstackManager.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
9C04BBFF10824CDD002A63D0 /* libBTstack.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* BTstackCocoa.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
9C04BBFE10824CDD002A63D0 /* libBTstack.dylib */,
9C04BB11107E9AC0002A63D0 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* BTstackCocoa_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* BTstackCocoa-Info.plist */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9C04BB11107E9AC0002A63D0 /* Classes */ = {
isa = PBXGroup;
children = (
9C5E109512DE4FD80013EF2C /* BTDiscoveryViewController.h */,
9C5E109612DE4FD80013EF2C /* BTstackManager.h */,
9C04BB19107E9AEF002A63D0 /* BTDevice.h */,
9C04BB12107E9AD8002A63D0 /* BTDevice.m */,
9C9AB4F112525E65008B4D52 /* BTDiscoveryViewController.m */,
9C9AB4F212525E65008B4D52 /* BTstackManager.m */,
9C9AB4F312525E65008B4D52 /* TestBTstackManager.m */,
);
name = Classes;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1D6058900D05DD3D006BFB54 /* BTstackCocoa */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "BTstackCocoa" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = BTstackCocoa;
productName = BTstackCocoa;
productReference = 1D6058910D05DD3D006BFB54 /* BTstackCocoa.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "BTstackCocoa" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
targets = (
1D6058900D05DD3D006BFB54 /* BTstackCocoa */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9C04BB16107E9AD8002A63D0 /* BTDevice.m in Sources */,
9C9AB4F412525E65008B4D52 /* BTDiscoveryViewController.m in Sources */,
9C9AB4F512525E65008B4D52 /* BTstackManager.m in Sources */,
9C9AB4F612525E65008B4D52 /* TestBTstackManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = BTstackCocoa_Prefix.pch;
INFOPLIST_FILE = "BTstackCocoa-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../src\"",
);
PRODUCT_NAME = BTstackCocoa;
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = BTstackCocoa_Prefix.pch;
INFOPLIST_FILE = "BTstackCocoa-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../src\"",
);
PRODUCT_NAME = BTstackCocoa;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = /Projects/iPhone/btstack/include;
OTHER_CFLAGS = (
"-I../",
"-I../CocoaTouch/include",
"-I../include",
);
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos4.3;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = /Projects/iPhone/btstack/include;
OTHER_CFLAGS = (
"-I../CocoaTouch/include",
"-I../include",
);
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "BTstackCocoa" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "BTstackCocoa" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View File

@ -1,8 +0,0 @@
//
// Prefix header for all source files of the 'BTstackCocoa' target in the 'BTstackCocoa' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@ -1,4 +1,5 @@
=== BTstack for iOS ===
# BTstack for iOS
BTstack for iOS provides an alternative Bluetooth stack for iOS devices with a public API.
@ -14,3 +15,62 @@ Note: As BTstack directly uses the Bluetooth hardware, the iOS Bluetooth is auto
Please visit the [project page at GitHub](https://github.com/bluekitchen/btstack/) for technical information and check the platform/ios subfolder.
## How to develop
To write BTstack-based applications, you don't need to compile the BTstack Cydia package. You can just install it on your
JB iOS device and copy /usr/lib/libBTstack.dylib into your project and add btstack/include to your project includes.
See btstack/platforms/example/WiiMoteOpenGLDemo for a Xcode-base example. In general, I highly recommend to use theos
to create apps & daemons for JB iOS devices instead of using Xcode.
## Compile Instructions
Install the following tools:
* Xcode 6.4 as /Applications/Xcode.app
* Xcode 4.4.1 as /Applications/Xcode-4.4.1.app/
* [rpetrich's theos fork](https://github.com/rpetrich/theos) with "lippoplastic" support
Set the $THEOS environment variable to the location of theos, e.g. like:
export THEOS=/Projects/theos
Go to btstack/platforms/ios and run make
cd btstack/platforms/ios
make package
If everything went right, you'll end up with a .deb package that you can install via:
make install
## Console Examples
With THEOS set-up as before, you can compile and install a set of command line examples in the example folder:
cd btstack/platforms/ios/example
make
You can copy the created examples to your device using scp
## Wii Mote CoocaTouch example
Similar as before, you can compile the WiiMoteOpenGLDemo by running make:
cd btstack/platforms/ios/example/WiiMoteOpenGLDemo
make package
You'll end up with a deb file that you can install with
make install
Note: as with any other JB application, you need to refresh the SpringBoard icon cache on the device to make the icon show up.
su mobile
uicache
exit

View File

@ -3,8 +3,8 @@ Name: SpringBoardAccess
Description: Controls status bar icons from daemons
Section: Networking
Architecture: iphoneos-arm
Depends: mobilesubstrate (>= 0.9.3367-1), firmware (<< 4.0) | libstatusbar (>= 0.9.7)
Depends: mobilesubstrate (>= 0.9.5101), firmware (<< 4.0) | libstatusbar (>= 0.9.8.4)
Author: Mattthias Ringwald <tickets@btstack.uservoice.com>
Maintainer: Mattthias Ringwald <tickets@btstack.uservoice.com>
Section: Development
Version: 0.3
Version: 0.4

View File

@ -275,7 +275,7 @@
texWidth, texHeight,
8, texWidth * 4,
CGImageGetColorSpace(textureImage),
kCGImageAlphaPremultipliedLast);
(CGBitmapInfo)kCGImageAlphaPremultipliedLast);
CGContextDrawImage(textureContext, CGRectMake(0.0, 0.0, (float)texWidth, (float)texHeight), textureImage);
CGContextRelease(textureContext);
@ -319,16 +319,6 @@
animationTimer = newTimer;
}
- (void)setAnimationInterval:(NSTimeInterval)interval {
animationInterval = interval;
if (animationTimer) {
[self stopAnimation];
[self startAnimation];
}
}
- (void)checkGLError:(BOOL)visibleCheck {
GLenum error = glGetError();

View File

@ -4,12 +4,16 @@
include $(THEOS)/makefiles/common.mk
BTSTACK_ROOT=../../../..
APPLICATION_NAME = WiiMoteOpenGLDemo
VPATH += ../../CocoaTouch/src
WiiMoteOpenGLDemo_FILES = $(wildcard *.c) $(wildcard *.m) $(wildcard Classes/*.m)
WiiMoteOpenGLDemo_FILES += ../../CocoaTouch/src/BTstackManager.m ../../CocoaTouch/src/BTDiscoveryViewController.m ../../CocoaTouch/src/BTDevice.m
WiiMoteOpenGLDemo_CFLAGS = -I. -I../.. -I Classes -I ../../include -I ../../CocoaTouch/include
WiiMoteOpenGLDemo_LDFLAGS = -L../../src -lbtstack
WiiMoteOpenGLDemo_FILES += BTstackManager.m BTDiscoveryViewController.m BTDevice.m
WiiMoteOpenGLDemo_CFLAGS = -I. -I../.. -I Classes -I $(BTSTACK_ROOT)/include -I ../../CocoaTouch/include
WiiMoteOpenGLDemo_LDFLAGS = -L../../.theos/_/usr/lib/ -lbtstack
WiiMoteOpenGLDemo_FRAMEWORKS = Foundation UIKit CoreGraphics OpenGLES QuartzCore
include $(FW_MAKEDIR)/application.mk

View File

@ -1,359 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1D3623260D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
9C0D06391091035200FC3BBA /* BTDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0D06361091035200FC3BBA /* BTDevice.m */; };
9C0D070D1092316D00FC3BBA /* EAGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0D070C1092316D00FC3BBA /* EAGLViewController.m */; };
9C5B871A13AFD09C00796016 /* wiimote_logo_55px.png in Resources */ = {isa = PBXBuildFile; fileRef = 9C5B871713AFD09C00796016 /* wiimote_logo_55px.png */; };
9C5B871B13AFD09C00796016 /* wiimote_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 9C5B871813AFD09C00796016 /* wiimote_logo.png */; };
9C5B871C13AFD09C00796016 /* wiimote_texture.png in Resources */ = {isa = PBXBuildFile; fileRef = 9C5B871913AFD09C00796016 /* wiimote_texture.png */; };
9C5E139612DE6C7B0013EF2C /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C5E139512DE6C7B0013EF2C /* OpenGLES.framework */; };
9C5E139A12DE6C8A0013EF2C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C5E139912DE6C8A0013EF2C /* CoreGraphics.framework */; };
9C5E139E12DE6C960013EF2C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C5E139D12DE6C960013EF2C /* UIKit.framework */; };
9C5E13A212DE6CAA0013EF2C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C5E13A112DE6CAA0013EF2C /* CoreFoundation.framework */; };
9C5E13A812DE6CB30013EF2C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C5E13A712DE6CB30013EF2C /* Foundation.framework */; };
9C8B71C712DBB9FE00E3FD8A /* BTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8B71C412DBB9FE00E3FD8A /* BTstackManager.m */; };
9C8B71C812DBB9FE00E3FD8A /* BTDiscoveryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8B71C612DBB9FE00E3FD8A /* BTDiscoveryViewController.m */; };
9CB96EEF10278D8D002663D0 /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28FD14FD0DC6FC130079059D /* EAGLView.m */; };
9CD1C867117E2F6900C7A4F4 /* libBTstack.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CD1C866117E2F6900C7A4F4 /* libBTstack.dylib */; settings = {ATTRIBUTES = (Weak, ); }; };
9CFFD60E11C5484300A37038 /* rotation.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CFFD60D11C5484300A37038 /* rotation.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1D3623240D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WiiMoteOpenGLDemoAppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WiiMoteOpenGLDemoAppDelegate.m; sourceTree = "<group>"; };
1D6058910D05DD3D006BFB54 /* WiiMoteOpenGLDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WiiMoteOpenGLDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
28FD14FC0DC6FC130079059D /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
28FD14FD0DC6FC130079059D /* EAGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EAGLView.m; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* WiiMoteOpenGLDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WiiMoteOpenGLDemo_Prefix.pch; sourceTree = "<group>"; };
9C0D06351091035200FC3BBA /* BTDevice.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTDevice.h; path = ../../CocoaTouch/include/BTstack/BTDevice.h; sourceTree = SOURCE_ROOT; };
9C0D06361091035200FC3BBA /* BTDevice.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTDevice.m; path = ../../CocoaTouch/src/BTDevice.m; sourceTree = SOURCE_ROOT; };
9C0D070B1092316D00FC3BBA /* EAGLViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLViewController.h; sourceTree = "<group>"; };
9C0D070C1092316D00FC3BBA /* EAGLViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EAGLViewController.m; sourceTree = "<group>"; };
9C18001B108B94FB00824BE7 /* btstack.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = btstack.h; sourceTree = "<group>"; };
9C18001C108B94FB00824BE7 /* hci_cmds.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = hci_cmds.h; sourceTree = "<group>"; };
9C18001D108B94FB00824BE7 /* linked_list.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = linked_list.h; sourceTree = "<group>"; };
9C18001E108B94FB00824BE7 /* run_loop.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = run_loop.h; sourceTree = "<group>"; };
9C18001F108B94FB00824BE7 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
9C5B871713AFD09C00796016 /* wiimote_logo_55px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = wiimote_logo_55px.png; path = Resources/wiimote_logo_55px.png; sourceTree = "<group>"; };
9C5B871813AFD09C00796016 /* wiimote_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = wiimote_logo.png; path = Resources/wiimote_logo.png; sourceTree = "<group>"; };
9C5B871913AFD09C00796016 /* wiimote_texture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = wiimote_texture.png; path = Resources/wiimote_texture.png; sourceTree = "<group>"; };
9C5E139512DE6C7B0013EF2C /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
9C5E139912DE6C8A0013EF2C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
9C5E139D12DE6C960013EF2C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
9C5E13A112DE6CAA0013EF2C /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
9C5E13A712DE6CB30013EF2C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
9C8B71C312DBB9FE00E3FD8A /* BTstackManager.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTstackManager.h; path = ../../CocoaTouch/include/BTstack/BTstackManager.h; sourceTree = SOURCE_ROOT; };
9C8B71C412DBB9FE00E3FD8A /* BTstackManager.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTstackManager.m; path = ../../CocoaTouch/src/BTstackManager.m; sourceTree = SOURCE_ROOT; };
9C8B71C512DBB9FE00E3FD8A /* BTDiscoveryViewController.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTDiscoveryViewController.h; path = ../../CocoaTouch/include/BTstack/BTDiscoveryViewController.h; sourceTree = SOURCE_ROOT; };
9C8B71C612DBB9FE00E3FD8A /* BTDiscoveryViewController.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTDiscoveryViewController.m; path = ../../CocoaTouch/src/BTDiscoveryViewController.m; sourceTree = SOURCE_ROOT; };
9CD1C866117E2F6900C7A4F4 /* libBTstack.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libBTstack.dylib; path = ../../src/libBTstack.dylib; sourceTree = SOURCE_ROOT; };
9CFFD60D11C5484300A37038 /* rotation.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; path = rotation.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9CD1C867117E2F6900C7A4F4 /* libBTstack.dylib in Frameworks */,
9C5E139612DE6C7B0013EF2C /* OpenGLES.framework in Frameworks */,
9C5E139A12DE6C8A0013EF2C /* CoreGraphics.framework in Frameworks */,
9C5E139E12DE6C960013EF2C /* UIKit.framework in Frameworks */,
9C5E13A212DE6CAA0013EF2C /* CoreFoundation.framework in Frameworks */,
9C5E13A812DE6CB30013EF2C /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
28FD14FC0DC6FC130079059D /* EAGLView.h */,
28FD14FD0DC6FC130079059D /* EAGLView.m */,
9C0D070B1092316D00FC3BBA /* EAGLViewController.h */,
9C0D070C1092316D00FC3BBA /* EAGLViewController.m */,
1D3623240D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.h */,
1D3623250D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.m */,
);
path = Classes;
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* WiiMoteOpenGLDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
9CD1C866117E2F6900C7A4F4 /* libBTstack.dylib */,
9C18001A108B94FB00824BE7 /* btstack */,
9CCE6DC71025E0A600FCE9F4 /* BTstack */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
9CFFD60D11C5484300A37038 /* rotation.c */,
32CA4F630368D1EE00C91783 /* WiiMoteOpenGLDemo_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
9C5B871713AFD09C00796016 /* wiimote_logo_55px.png */,
9C5B871813AFD09C00796016 /* wiimote_logo.png */,
9C5B871913AFD09C00796016 /* wiimote_texture.png */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
9C5E139512DE6C7B0013EF2C /* OpenGLES.framework */,
9C5E139912DE6C8A0013EF2C /* CoreGraphics.framework */,
9C5E139D12DE6C960013EF2C /* UIKit.framework */,
9C5E13A112DE6CAA0013EF2C /* CoreFoundation.framework */,
9C5E13A712DE6CB30013EF2C /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9C18001A108B94FB00824BE7 /* btstack */ = {
isa = PBXGroup;
children = (
9C18001B108B94FB00824BE7 /* btstack.h */,
9C18001C108B94FB00824BE7 /* hci_cmds.h */,
9C18001D108B94FB00824BE7 /* linked_list.h */,
9C18001E108B94FB00824BE7 /* run_loop.h */,
9C18001F108B94FB00824BE7 /* utils.h */,
);
name = btstack;
path = ../../include/btstack;
sourceTree = SOURCE_ROOT;
};
9CCE6DC71025E0A600FCE9F4 /* BTstack */ = {
isa = PBXGroup;
children = (
9C0D06351091035200FC3BBA /* BTDevice.h */,
9C0D06361091035200FC3BBA /* BTDevice.m */,
9C8B71C312DBB9FE00E3FD8A /* BTstackManager.h */,
9C8B71C412DBB9FE00E3FD8A /* BTstackManager.m */,
9C8B71C512DBB9FE00E3FD8A /* BTDiscoveryViewController.h */,
9C8B71C612DBB9FE00E3FD8A /* BTDiscoveryViewController.m */,
);
name = BTstack;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1D6058900D05DD3D006BFB54 /* WiiMoteOpenGLDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "WiiMoteOpenGLDemo" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = WiiMoteOpenGLDemo;
productName = WiiMoteOpenGLDemo;
productReference = 1D6058910D05DD3D006BFB54 /* WiiMoteOpenGLDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WiiMoteOpenGLDemo" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
targets = (
1D6058900D05DD3D006BFB54 /* WiiMoteOpenGLDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9C5B871A13AFD09C00796016 /* wiimote_logo_55px.png in Resources */,
9C5B871B13AFD09C00796016 /* wiimote_logo.png in Resources */,
9C5B871C13AFD09C00796016 /* wiimote_texture.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1D3623260D0F684500981E51 /* WiiMoteOpenGLDemoAppDelegate.m in Sources */,
9CB96EEF10278D8D002663D0 /* EAGLView.m in Sources */,
9C0D06391091035200FC3BBA /* BTDevice.m in Sources */,
9C0D070D1092316D00FC3BBA /* EAGLViewController.m in Sources */,
9CFFD60E11C5484300A37038 /* rotation.c in Sources */,
9C8B71C712DBB9FE00E3FD8A /* BTstackManager.m in Sources */,
9C8B71C812DBB9FE00E3FD8A /* BTDiscoveryViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = WiiMoteOpenGLDemo_Prefix.pch;
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../src\"",
);
PRODUCT_NAME = WiiMoteOpenGLDemo;
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = WiiMoteOpenGLDemo_Prefix.pch;
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../btstack/src\"",
"\"$(SRCROOT)/../../src\"",
);
PRODUCT_NAME = WiiMoteOpenGLDemo;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Resources/Info.plist;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-I../../CocoaTouch/include",
"-I../../include",
);
OTHER_CPLUSPLUSFLAGS = "";
OTHER_LDFLAGS = (
"-L../../src/",
"-lbtstack",
);
PREBINDING = NO;
SDKROOT = iphoneos3.0;
USER_HEADER_SEARCH_PATHS = "";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-I../../CocoaTouch/include",
"-I../../include",
);
OTHER_CPLUSPLUSFLAGS = "";
OTHER_LDFLAGS = (
"-L../../src/",
"-lbtstack",
);
PREBINDING = NO;
SDKROOT = iphoneos3.0;
USER_HEADER_SEARCH_PATHS = "";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "WiiMoteOpenGLDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "WiiMoteOpenGLDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View File

@ -1,8 +0,0 @@
//
// Prefix header for all source files of the 'WiiMoteOpenGLDemo' target in the 'WiiMoteOpenGLDemo' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@ -5,7 +5,7 @@ Section: Networking
Architecture: iphoneos-arm
Breaks: co.cocoanuts.celeste (<= 0.90)
Pre-Depends: ldid
Depends: firmware (>= 3.0), ch.ringwald.springboardaccess (>= 0.3), preferenceloader (>= 2.0.2)
Depends: firmware (>= 3.0), ch.ringwald.springboardaccess (>= 0.3), preferenceloader (>= 2.2.2)
Author: Mattthias Ringwald <tickets@btstack.uservoice.com>
Maintainer: Mattthias Ringwald <tickets@btstack.uservoice.com>
Section: Development

View File

@ -1172,6 +1172,8 @@ static int l2cap_channel_ready_for_open(l2cap_channel_t *channel){
// log_info("l2cap_channel_ready_for_open 0x%02x", channel->state_var);
if ((channel->state_var & L2CAP_CHANNEL_STATE_VAR_RCVD_CONF_RSP) == 0) return 0;
if ((channel->state_var & L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP) == 0) return 0;
// addition check that fixes re-entrance issue causing l2cap event channel opened twice
if (channel->state == L2CAP_STATE_OPEN) return 0;
return 1;
}

View File

@ -66,6 +66,11 @@
#include "pan.h"
#include "stdin_support.h"
#define NETWORK_TYPE_IPv4 0x800
#define NETWORK_TYPE_IPv6 0x86DD
#define ICMP_TYPE_PING_REQUEST 0x08
#define ICMP_TYPE_PING_RESPONSE 0x00
// prototypes
static void show_usage();
@ -134,7 +139,7 @@ static void send_buffer(uint16_t pos){
}
static void send_ethernet_packet(int src_compressed, int dst_compressed){
int pos = setup_ethernet_header(src_compressed, dst_compressed, 0, 0x0800); // IPv4
int pos = setup_ethernet_header(src_compressed, dst_compressed, 0, NETWORK_TYPE_IPv4); // IPv4
// dummy data Ethernet packet
int i;
for (i = 60; i >= 0 ; i--){
@ -155,6 +160,8 @@ static void set_multicast_filter(void){
bnep_set_multicast_filter(bnep_cid, multicast_filter, 1);
}
#if 0
/* From RFC 5227 - 2.1.1
A host probes to see if an address is already in use by broadcasting
an ARP Request for the desired address. The client MUST fill in the
@ -178,7 +185,7 @@ static void send_arp_probe_ipv4(void){
net_store_16(network_buffer, pos, 0x0001); // Hardware type (HTYPE), 1 = Ethernet
pos += 2;
net_store_16(network_buffer, pos, 0x0800); // Protocol type (PTYPE), 0x800 = IPv4
net_store_16(network_buffer, pos, NETWORK_TYPE_IPv4); // Protocol type (PTYPE), 0x800 = IPv4
pos += 2;
network_buffer[pos++] = 6; // Hardware length (HLEN) - 6 MAC Address
network_buffer[pos++] = 4; // Protocol length (PLEN) - 4 IPv4 Address
@ -201,7 +208,6 @@ static void send_arp_probe_ipv6(void){
}
#if 0
static void send_dhcp_discovery(void){
}
@ -213,14 +219,13 @@ static void send_dhcp_request(void){
static void send_dns_request(void){
}
#endif
static void send_some_ipv6_packet(void){
bd_addr_t an_addr = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x16};
memcpy(other_addr, an_addr, 6);
int pos = setup_ethernet_header(1, 0, 0, 0x86DD); // IPv6
int pos = setup_ethernet_header(1, 0, 0, NETWORK_TYPE_IPv6); // IPv6
uint8_t ipv6_packet[] = {
0x60, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x02,
@ -239,7 +244,7 @@ static void send_some_ipv6_packet_2(void){
bd_addr_t an_addr = { 0x33, 0x33, 0xFF, 0x60, 0x7B, 0x87};
memcpy(other_addr, an_addr, 6);
int pos = setup_ethernet_header(1, 0, 0, 0x86DD); // IPv6
int pos = setup_ethernet_header(1, 0, 0, NETWORK_TYPE_IPv6); // IPv6
uint8_t ipv6_packet[] = {
0x60, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x02,
@ -251,6 +256,150 @@ static void send_some_ipv6_packet_2(void){
pos += sizeof(ipv6_packet);
send_buffer(pos);
}
#endif
static uint16_t sum_ones_complement(uint16_t a, uint16_t b){
uint32_t sum = a + b;
while (sum > 0xffff){
sum = (sum & 0xffff) + 1;
}
return sum;
}
static uint16_t calc_internet_checksum(uint8_t * data, int size){
uint32_t checksum = 0;
while (size){
// add 16-bit value
checksum = sum_ones_complement(checksum, *(uint16_t*)data);
data += 2;
size -= 2;
}
return checksum;
}
static void send_ping_request_ipv4(void){
uint8_t ipv4_packet[] = {
// ip
0x45, 0x00, 0x00, 0x00, // version + ihl, dscp } ecn, total len
0x00, 0x00, 0x00, 0x00, // identification (16), flags + fragment offset
0x01, 0x01, 0x00, 0x00, // time to live, procotol: icmp, checksum (16),
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
};
uint8_t icmp_packet[] = {
// icmp
0x08, 0x00, 0x00, 0x00, // type: 0x08 PING Request
0x00, 0x00, 0x00, 0x00
};
// ethernet header
int pos = setup_ethernet_header(1, 0, 0, NETWORK_TYPE_IPv4); // IPv4
// ipv4
int total_length = sizeof(ipv4_packet) + sizeof(icmp_packet);
net_store_16(ipv4_packet, 2, total_length);
uint16_t ipv4_checksum = calc_internet_checksum(ipv4_packet, sizeof(ipv4_packet));
net_store_16(ipv4_packet, 10, ipv4_checksum);
// TODO: also set src/dest ip address
memcpy(&network_buffer[pos], ipv4_packet, sizeof(ipv4_packet));
pos += sizeof(ipv4_packet);
// icmp
uint16_t icmp_checksum = calc_internet_checksum(icmp_packet, sizeof(icmp_packet));
net_store_16(icmp_packet, 2, icmp_checksum);
memcpy(&network_buffer[pos], icmp_packet, sizeof(icmp_packet));
pos += sizeof(icmp_packet);
// send
send_buffer(pos);
}
static void send_ping_request_ipv6(void){
uint8_t ipv6_packet[] = {
// ip
0x60, 0x00, 0x00, 0x00, // version (4) + traffic class (8) + flow label (24)
0x00, 0x00, 58, 0x01, // payload length(16), next header = IPv6-ICMP, hop limit
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
};
uint8_t icmp_packet[] = {
// icmp
0x80, 0x00, 0x00, 0x00, // type: 0x08 PING Request, codde = 0, checksum(16)
0x00, 0x00, 0x00, 0x00 // message
};
// ethernet header
int pos = setup_ethernet_header(1, 0, 0, NETWORK_TYPE_IPv4); // IPv4
// ipv6
int payload_length = sizeof(icmp_packet);
net_store_16(ipv6_packet, 4, payload_length);
// TODO: also set src/dest ip address
int checksum = calc_internet_checksum(&ipv6_packet[8], 32);
checksum = sum_ones_complement(checksum, sizeof(ipv6_packet) + sizeof(icmp_packet));
checksum = sum_ones_complement(checksum, 58 << 8);
net_store_16(icmp_packet, 2, checksum);
memcpy(&network_buffer[pos], ipv6_packet, sizeof(ipv6_packet));
pos += sizeof(ipv6_packet);
// icmp
uint16_t icmp_checksum = calc_internet_checksum(icmp_packet, sizeof(icmp_packet));
net_store_16(icmp_packet, 2, icmp_checksum);
memcpy(&network_buffer[pos], icmp_packet, sizeof(icmp_packet));
pos += sizeof(icmp_packet);
// send
send_buffer(pos);
}
static void send_ping_response_ipv4(void){
uint8_t ipv4_packet[] = {
// ip
0x45, 0x00, 0x00, 0x00, // version + ihl, dscp } ecn, total len
0x00, 0x00, 0x00, 0x00, // identification (16), flags + fragment offset
0x01, 0x01, 0x00, 0x00, // time to live, procotol: icmp, checksum (16),
0x00, 0x00, 0x00, 0x00, // source IP address
0x00, 0x00, 0x00, 0x00, // destination IP address
};
uint8_t icmp_packet[] = {
// icmp
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
// ethernet header
int pos = setup_ethernet_header(1, 0, 0, NETWORK_TYPE_IPv4); // IPv4
// ipv4
int total_length = sizeof(ipv4_packet) + sizeof(icmp_packet);
net_store_16(ipv4_packet, 2, total_length);
uint16_t ipv4_checksum = calc_internet_checksum(ipv4_packet, sizeof(ipv4_packet));
net_store_16(ipv4_packet, 10, ipv4_checksum);
// TODO: also set src/dest ip address
memcpy(&network_buffer[pos], ipv4_packet, sizeof(ipv4_packet));
pos += sizeof(ipv4_packet);
// icmp
uint16_t icmp_checksum = calc_internet_checksum(icmp_packet, sizeof(icmp_packet));
net_store_16(icmp_packet, 2, icmp_checksum);
memcpy(&network_buffer[pos], icmp_packet, sizeof(icmp_packet));
pos += sizeof(icmp_packet);
// send
send_buffer(pos);
}
static void show_usage(void){
@ -267,12 +416,16 @@ static void show_usage(void){
printf("f - set network filter\n");
printf("m - set multicast network filter\n");
printf("---\n");
printf("1 - send ICMP Ping Request IPv4\n");
printf("2 - send ICMP Ping Request IPv6\n");
#if 0
printf("1 - get IP address via DHCP\n");
printf("2 - send DNS request\n");
printf("4 - send IPv4 ARP request\n");
printf("6 - send IPv6 ARP request\n");
printf("9 - send some IPv6 packet\n");
printf("0 - send some IPv6 packet 2\n");
#endif
printf("---\n");
printf("Ctrl-c - exit\n");
printf("---\n");
@ -311,6 +464,15 @@ static int stdin_process(struct data_source *ds){
printf("Setting multicast filter\n");
set_multicast_filter();
break;
case '1':
printf("Sending ICMP Ping via IPv4\n");
send_ping_request_ipv4();
break;
case '2':
printf("Sending ICMP Ping via IPv6\n");
send_ping_request_ipv6();
break;
#if 0
case '4':
printf("Sending IPv4 ARP Probe\n");
send_arp_probe_ipv4();
@ -327,6 +489,7 @@ static int stdin_process(struct data_source *ds){
printf("Sending some IPv6 packet 2\n");
send_some_ipv6_packet_2();
break;
#endif
default:
show_usage();
break;
@ -336,15 +499,20 @@ static int stdin_process(struct data_source *ds){
}
/*************** PANU client routines *********************/
static void packet_handler (void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
{
uint8_t event;
bd_addr_t event_addr;
bd_addr_t src_addr;
bd_addr_t dst_addr;
uint16_t uuid_source;
uint16_t uuid_dest;
uint16_t mtu;
uint16_t network_type;
uint8_t icmp_type;
int ihl;
int payload_offset;
switch (packet_type) {
case HCI_EVENT_PACKET:
event = packet[0];
@ -408,12 +576,39 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
break;
case BNEP_DATA_PACKET:
// show received packet on console
// TODO: fix BNEP to return BD ADDR in little endian, to use these lines
// bt_flip_addr(dst_addr, &packet[0]);
// bt_flip_addr(src_addr, &packet[6]);
// instead of these
memcpy(dst_addr, &packet[0], 6);
memcpy(src_addr, &packet[6], 6);
// END TOOD
network_type = READ_NET_16(packet, 12);
printf("BNEP packet received\n");
printf("Dst Addr: %s\n", bd_addr_to_str(&packet[0]));
printf("Src Addr: %s\n", bd_addr_to_str(&packet[6]));
printf("Net Type: %04x\n", READ_NET_16(packet, 12));
printf("Dst Addr: %s\n", bd_addr_to_str(dst_addr));
printf("Src Addr: %s\n", bd_addr_to_str(src_addr));
printf("Net Type: %04x\n", network_type);
// ignore the next 60 bytes
hexdumpf(&packet[74], size - 74);
switch (network_type){
case NETWORK_TYPE_IPv4:
ihl = packet[14] & 0x0f;
payload_offset = 14 + (ihl << 2);
//
icmp_type = packet[payload_offset];
hexdumpf(&packet[payload_offset], size - payload_offset);
printf("ICMP packet of type %x\n", icmp_type);
switch (icmp_type){
case ICMP_TYPE_PING_REQUEST:
printf("IPv4 Ping Request received, sending pong\n");
send_ping_response_ipv4();
break;
break;
}
}
break;
default: