Skip to content

I tried the server in example folder, but I cannot find the ble server on my iphone #138

Closed

Description

@unicorn200066

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
If applicable, provide a clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. unicorn200066 commented on Sep 27, 2024

    @unicorn200066
    Author

    `import asyncio
    import logging
    import uuid
    from time import sleep
    from typing import Optional

    from bless import *

    logging.basicConfig(level=logging.DEBUG)
    logger = logging.getLogger(name=name)

    async def test_ble_server(loop):
    trigger = asyncio.Event()
    trigger.clear()
    server : BlessServer = BlessServer("MyBleServer", loop=loop)

    service_uuid : str = str(uuid.uuid4())
    await server.add_new_service(service_uuid)
    
    
    char_uuid : str = str(uuid.uuid4())
    char_flags: GATTCharacteristicProperties = (
            GATTCharacteristicProperties.read |
            GATTCharacteristicProperties.write |
            GATTCharacteristicProperties.notify
    )
    value: Optional[bytearray] = None
    permissions: GATTAttributePermissions = (
            GATTAttributePermissions.readable |
            GATTAttributePermissions.writeable
    )
    await server.add_new_characteristic(service_uuid, char_uuid, char_flags, value, permissions)
    
    await server.start()
    logger.info(f"server name is {server.name}")
    is_advertising = await server.is_advertising()
    logger.info(f"server is advertising: {is_advertising}")
    
    await trigger.wait()
    

    if name == "main":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(test_ble_server(loop))

    `

    I ran the code above, however while the server is running, I could not find "MyBleServer" device on my iphone

  2. Repository owner locked and limited conversation to collaborators on Sep 27, 2024
  3. converted this issue into a discussion #139 on Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions