code_junkie

How do you make the iPhone vibrate for arbitrary durations?

Nov 12th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
  2.  
  3. MeCCA_Vibrator *v = new MeCCA_Vibrator;
  4. v->activate(1);
  5. sleep(5);
  6. v->deactivate();
  7.  
  8. extern void * _CTServerConnectionCreate(CFAllocatorRef, int (*)(void *, CFStringRef, CFDictionaryRef, void *), int *);
  9. extern int _CTServerConnectionSetVibratorState(int *, void *, int, int, float, float, float);
  10.  
  11. connection = _CTServerConnectionCreate(kCFAllocatorDefault, &vibratecallback, &x);
  12.  
  13. _CTServerConnectionSetVibratorState(&x, connection, 3, intensity, 0, 0, 0);
  14.  
  15. _CTServerConnectionSetVibratorState(&x, connection, 0, 0, 0, 0, 0);
Add Comment
Please, Sign In to add comment